mirror of
https://github.com/androidx/media.git
synced 2025-04-29 22:36:54 +08:00
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 816d5cb86b13629a7ca23dba122f943f175d3bb9)
This commit is contained in:
parent
8e2ed3bf4d
commit
0a284f4927
@ -1723,11 +1723,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
|
||||
// We are not rendering on a surface, the renderer will wait until a surface is set.
|
||||
if (displaySurface == null) {
|
||||
// Skip frames in sync with playback, so we'll be at the right frame if the mode changes.
|
||||
if ((videoFrameReleaseInfo.getEarlyUs() < 0
|
||||
&& shouldSkipLateBuffersWhileUsingPlaceholderSurface())
|
||||
|| (videoFrameReleaseInfo.getEarlyUs() < 30_000
|
||||
&& frameReleaseAction != VideoFrameReleaseControl.FRAME_RELEASE_TRY_AGAIN_LATER)) {
|
||||
// Skip frames in sync with playback, so we'll be at the right frame if a surface is set.
|
||||
if (getState() == STATE_STARTED && videoFrameReleaseInfo.getEarlyUs() < 30_000) {
|
||||
skipOutputBuffer(codec, bufferIndex, presentationTimeUs);
|
||||
updateVideoFrameProcessingOffsetCounters(videoFrameReleaseInfo.getEarlyUs());
|
||||
return true;
|
||||
@ -1876,11 +1873,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns whether to skip late buffers while using a placeholder surface. */
|
||||
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether to force rendering an output buffer.
|
||||
*
|
||||
|
@ -210,12 +210,6 @@ public class ParseAv1SampleDependenciesPlaybackTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
|
||||
// Do not skip buffers while using placeholder surface due to slow processing.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldForceRenderOutputBuffer(long earlyUs, long elapsedSinceLastRenderUs) {
|
||||
// An auto-advancing FakeClock can make a lot of progress before
|
||||
|
@ -265,12 +265,6 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
|
||||
// Do not skip buffers with identical vsync times as we can't control this from tests.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldSkipLateBuffersWhileUsingPlaceholderSurface() {
|
||||
// Do not skip buffers while using placeholder surface due to slow processing.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user