Skip to content

Commit 0a284f4

Browse files
committed
Refine logic of when to skip placeholder surface buffers
We want to skip the buffers in sync with playback, which only makes progress once started. This means we can simplify the logic to only apply the 30ms threashold when started (which was indirectly the threashold used already because the frame release would return TRY_AGAIN_LATER). This means we can remove the shouldSkipLateBuffersWhileUsingPlaceholderSurface as it was only used in tests to prevent skipping while we were not started. PiperOrigin-RevId: 736533043 (cherry picked from commit 816d5cb)
1 parent 8e2ed3b commit 0a284f4

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,11 +1723,8 @@ public void skip() {
17231723

17241724
// We are not rendering on a surface, the renderer will wait until a surface is set.
17251725
if (displaySurface == null) {
1726-
// Skip frames in sync with playback, so we'll be at the right frame if the mode changes.
1727-
if ((videoFrameReleaseInfo.getEarlyUs() < 0
1728-
&& shouldSkipLateBuffersWhileUsingPlaceholderSurface())
1729-
|| (videoFrameReleaseInfo.getEarlyUs() < 30_000
1730-
&& frameReleaseAction != VideoFrameReleaseControl.FRAME_RELEASE_TRY_AGAIN_LATER)) {
1726+
// Skip frames in sync with playback, so we'll be at the right frame if a surface is set.
1727+
if (getState() == STATE_STARTED && videoFrameReleaseInfo.getEarlyUs() < 30_000) {
17311728
skipOutputBuffer(codec, bufferIndex, presentationTimeUs);
17321729
updateVideoFrameProcessingOffsetCounters(videoFrameReleaseInfo.getEarlyUs());
17331730
return true;
@@ -1876,11 +1873,6 @@ protected boolean shouldSkipBuffersWithIdenticalReleaseTime() {
18761873
return true;
18771874
}
18781875

1879-
/** Returns whether to skip late buffers while using a placeholder surface. */
1880-
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
1881-
return true;
1882-
}
1883-
18841876
/**
18851877
* Returns whether to force rendering an output buffer.
18861878
*

libraries/exoplayer/src/test/java/androidx/media3/exoplayer/e2etest/ParseAv1SampleDependenciesPlaybackTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ protected boolean shouldSkipBuffersWithIdenticalReleaseTime() {
210210
return false;
211211
}
212212

213-
@Override
214-
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
215-
// Do not skip buffers while using placeholder surface due to slow processing.
216-
return false;
217-
}
218-
219213
@Override
220214
protected boolean shouldForceRenderOutputBuffer(long earlyUs, long elapsedSinceLastRenderUs) {
221215
// An auto-advancing FakeClock can make a lot of progress before

libraries/test_utils/src/main/java/androidx/media3/test/utils/CapturingRenderersFactory.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ protected boolean shouldSkipBuffersWithIdenticalReleaseTime() {
265265
// Do not skip buffers with identical vsync times as we can't control this from tests.
266266
return false;
267267
}
268-
269-
@Override
270-
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
271-
// Do not skip buffers while using placeholder surface due to slow processing.
272-
return false;
273-
}
274268
}
275269

276270
/**

0 commit comments

Comments
 (0)