From b782cdff5284b8ba45d3b8791288cb67717b610b Mon Sep 17 00:00:00 2001 From: kimvde Date: Tue, 19 Nov 2024 01:12:08 -0800 Subject: [PATCH] Don't drop frames to ignore in RenderControl The following was happening: - VideoFrameRenderControl.render() was calling VideoFrameReleaseAction.getFrameReleaseAction(). - VideoFrameReleaseAction.getFrameReleaseAction() was calling FrameTimingEvaluator.shouldIgnoreFrame(), which is implemented in MediaCodecVideoRenderer. - MediaCodecVideoRenderer.shouldIgnoreFrame(), when returning true, was also flushing the VideoSink, which was flushing the VideoFrameRenderControl. - VideoFrameRenderControl.render() was removing the frame from the presentationTimestampsUs queue, but the frame had already been removed by the flush operation, causing an exception to be thrown. This fix removes the last step. PiperOrigin-RevId: 697915692 --- .../media3/exoplayer/video/VideoFrameRenderControl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameRenderControl.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameRenderControl.java index ae0e8ce732..16db1ebeb7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameRenderControl.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameRenderControl.java @@ -160,11 +160,13 @@ import androidx.media3.exoplayer.ExoPlaybackException; return; case VideoFrameReleaseControl.FRAME_RELEASE_SKIP: case VideoFrameReleaseControl.FRAME_RELEASE_DROP: + lastOutputPresentationTimeUs = presentationTimeUs; + dropFrame(); + break; case VideoFrameReleaseControl.FRAME_RELEASE_IGNORE: // TODO b/293873191 - Handle very late buffers and drop to key frame. Need to flush // VideoGraph input frames in this case. lastOutputPresentationTimeUs = presentationTimeUs; - dropFrame(); break; case VideoFrameReleaseControl.FRAME_RELEASE_IMMEDIATELY: case VideoFrameReleaseControl.FRAME_RELEASE_SCHEDULED: