/** * Returns the sum of the skipped, dropped and rendered buffers. * * @param counters The counters for which the total should be calculated. * @return The sum of the skipped, dropped and rendered buffers. */ public static int getTotalBufferCount(DecoderCounters counters) { counters.ensureUpdated(); return counters.skippedOutputBufferCount + counters.droppedBufferCount + counters.renderedOutputBufferCount; }
@Override protected void onEnabled(boolean joining) throws ExoPlaybackException { decoderCounters = new DecoderCounters(); }
private static String getDecoderCountersBufferCountString(DecoderCounters counters) { if (counters == null) { return ""; } counters.ensureUpdated(); return " sib:" + counters.skippedInputBufferCount + " sb:" + counters.skippedOutputBufferCount + " rb:" + counters.renderedOutputBufferCount + " db:" + counters.droppedBufferCount + " mcdb:" + counters.maxConsecutiveDroppedBufferCount + " dk:" + counters.droppedToKeyframeCount; }
/** * @param tag A tag to use for logging. * @param expectedPlayingTimeMs The expected playing time. If set to a non-negative value, the * test will assert that the total time spent playing the media was within * {@link #MAX_PLAYING_TIME_DISCREPANCY_MS} of the specified value. * {@link #EXPECTED_PLAYING_TIME_MEDIA_DURATION_MS} should be passed to assert that the * expected playing time equals the duration of the media being played. Else * {@link #EXPECTED_PLAYING_TIME_UNSET} should be passed to indicate that the test should not * assert an expected playing time. * @param failOnPlayerError Whether a player error should be considered a test failure. */ public ExoHostedTest(String tag, long expectedPlayingTimeMs, boolean failOnPlayerError) { this.tag = tag; this.expectedPlayingTimeMs = expectedPlayingTimeMs; this.failOnPlayerError = failOnPlayerError; this.testFinished = new ConditionVariable(); this.videoDecoderCounters = new DecoderCounters(); this.audioDecoderCounters = new DecoderCounters(); }
/** Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}. */ public void disabled(DecoderCounters counters) { if (listener != null) { handler.post( () -> { counters.ensureUpdated(); listener.onVideoDisabled(counters); }); } }
@Override protected void onEnabled(boolean joining) throws ExoPlaybackException { decoderCounters = new DecoderCounters(); eventDispatcher.enabled(decoderCounters); }
/** * Returns the sum of the skipped, dropped and rendered buffers. * * @param counters The counters for which the total should be calculated. * @return The sum of the skipped, dropped and rendered buffers. */ public static int getTotalBufferCount(DecoderCounters counters) { counters.ensureUpdated(); return counters.skippedOutputBufferCount + counters.droppedBufferCount + counters.renderedOutputBufferCount; }
/** * @param tag A tag to use for logging. * @param expectedPlayingTimeMs The expected playing time. If set to a non-negative value, the * test will assert that the total time spent playing the media was within * {@link #MAX_PLAYING_TIME_DISCREPANCY_MS} of the specified value. * {@link #EXPECTED_PLAYING_TIME_MEDIA_DURATION_MS} should be passed to assert that the * expected playing time equals the duration of the media being played. Else * {@link #EXPECTED_PLAYING_TIME_UNSET} should be passed to indicate that the test should not * assert an expected playing time. * @param failOnPlayerError Whether a player error should be considered a test failure. */ public ExoHostedTest(String tag, long expectedPlayingTimeMs, boolean failOnPlayerError) { this.tag = tag; this.expectedPlayingTimeMs = expectedPlayingTimeMs; this.failOnPlayerError = failOnPlayerError; this.testFinished = new ConditionVariable(); this.videoDecoderCounters = new DecoderCounters(); this.audioDecoderCounters = new DecoderCounters(); }
/** * Invokes {@link AudioRendererEventListener#onAudioDisabled(DecoderCounters)}. */ public void disabled(final DecoderCounters counters) { if (listener != null) { handler.post( () -> { counters.ensureUpdated(); listener.onAudioDisabled(counters); }); } }
public FakeVideoRenderer(Handler handler, VideoRendererEventListener eventListener) { super(Builder.VIDEO_FORMAT); eventDispatcher = new VideoRendererEventListener.EventDispatcher(handler, eventListener); decoderCounters = new DecoderCounters(); }
public static void assertSkippedOutputBufferCount(String name, DecoderCounters counters, int expected) { counters.ensureUpdated(); int actual = counters.skippedOutputBufferCount; assertWithMessage( "Codec(" + name + ") skipped " + actual + " buffers. Expected " + expected + ".") .that(actual) .isEqualTo(expected); }
public FakeAudioRenderer(Handler handler, AudioRendererEventListener eventListener) { super(Builder.AUDIO_FORMAT); eventDispatcher = new AudioRendererEventListener.EventDispatcher(handler, eventListener); decoderCounters = new DecoderCounters(); }
public static void assertDroppedBufferLimit(String name, DecoderCounters counters, int limit) { counters.ensureUpdated(); int actual = counters.droppedBufferCount; assertWithMessage( "Codec(" + name + ") was late decoding: " + actual + " buffers. " + "Limit: " + limit + ".") .that(actual) .isAtMost(limit); }
@Override protected void onEnabled(boolean joining) throws ExoPlaybackException { decoderCounters = new DecoderCounters(); eventDispatcher.enabled(decoderCounters); int tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId; if (tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET) { audioSink.enableTunnelingV21(tunnelingAudioSessionId); } else { audioSink.disableTunneling(); } }
@Override protected void onDisabled() { try { lastInputTimeUs = C.TIME_UNSET; pendingStreamChangeCount = 0; audioSink.release(); } finally { try { super.onDisabled(); } finally { decoderCounters.ensureUpdated(); eventDispatcher.disabled(decoderCounters); } } }
public static void assertConsecutiveDroppedBufferLimit(String name, DecoderCounters counters, int limit) { counters.ensureUpdated(); int actual = counters.maxConsecutiveDroppedBufferCount; assertWithMessage( "Codec(" + name + ") was late decoding: " + actual + " buffers consecutively. " + "Limit: " + limit + ".") .that(actual) .isAtMost(limit); }
@Override protected void onDisabled() { currentWidth = Format.NO_VALUE; currentHeight = Format.NO_VALUE; currentPixelWidthHeightRatio = Format.NO_VALUE; pendingPixelWidthHeightRatio = Format.NO_VALUE; outputStreamOffsetUs = C.TIME_UNSET; lastInputTimeUs = C.TIME_UNSET; pendingOutputStreamOffsetCount = 0; clearReportedVideoSize(); clearRenderedFirstFrame(); frameReleaseTimeHelper.disable(); tunnelingOnFrameRenderedListener = null; tunneling = false; try { super.onDisabled(); } finally { decoderCounters.ensureUpdated(); eventDispatcher.disabled(decoderCounters); } }
@Override protected void onDisabled() { inputFormat = null; audioTrackNeedsConfigure = true; waitingForKeys = false; try { releaseDecoder(); audioSink.release(); } finally { try { if (drmSession != null) { drmSessionManager.releaseSession(drmSession); } } finally { try { if (pendingDrmSession != null && pendingDrmSession != drmSession) { drmSessionManager.releaseSession(pendingDrmSession); } } finally { drmSession = null; pendingDrmSession = null; decoderCounters.ensureUpdated(); eventDispatcher.disabled(decoderCounters); } } } }