Use VideoSink directly in MCVR where possible

PiperOrigin-RevId: 630030889
This commit is contained in:
kimvde 2024-05-02 05:21:46 -07:00 committed by Copybara-Service
parent 0893275841
commit d059e97b28

View File

@ -647,11 +647,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
@Override
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException {
// When this renderer doesn't own the VideoSinkProvider, it's possible that the VideoSink is
// already initialized by another renderer, before this renderer is enabled.
// When this renderer doesn't own the VideoSink, it's possible that the VideoSink is already
// initialized by another renderer, before this renderer is enabled.
// Flush the video sink first to ensure it stops reading textures that will be owned by
// MediaCodec once the codec is flushed.
videoSinkProvider.getSink().flush();
videoSink.flush();
super.onPositionReset(positionUs, joining);
videoFrameReleaseControl.reset();
if (joining) {
@ -1451,9 +1451,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
super.onProcessedStreamChange();
videoFrameReleaseControl.onProcessedStreamChange();
maybeSetupTunnelingForFirstFrame();
// If the renderer does not own the VideoSinkProvider, it's possible the VideoSink is null when
// this method is invoked, that is when transitioning from another renderer.
videoSinkProvider.getSink().setStreamOffsetUs(getOutputStreamOffsetUs());
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
}
/**