Always reconfigure video sink for video after image
Before this CL, the video sink was not reconfigured for the second video in a sequence with video-image-video. For example, the stream offset and listener were not set for the second video. PiperOrigin-RevId: 628065991
This commit is contained in:
parent
0e3b05c67d
commit
00ce572a4f
@ -1068,8 +1068,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
ownsVideoSinkProvider && hasEffects && !hasInitializedPlayback;
|
ownsVideoSinkProvider && hasEffects && !hasInitializedPlayback;
|
||||||
// We always use the video sink if the video sink provider is passed to the renderer.
|
// We always use the video sink if the video sink provider is passed to the renderer.
|
||||||
boolean useVideoSink = enableEffectsForOwnSinkProvider || !ownsVideoSinkProvider;
|
boolean useVideoSink = enableEffectsForOwnSinkProvider || !ownsVideoSinkProvider;
|
||||||
if (useVideoSink && videoSink == null) {
|
if (useVideoSink) {
|
||||||
try {
|
|
||||||
videoSinkProvider.setStreamOffsetUs(getOutputStreamOffsetUs());
|
videoSinkProvider.setStreamOffsetUs(getOutputStreamOffsetUs());
|
||||||
videoSink = videoSinkProvider.getSink();
|
videoSink = videoSinkProvider.getSink();
|
||||||
if (!videoSink.isInitialized()) {
|
if (!videoSink.isInitialized()) {
|
||||||
@ -1122,12 +1121,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
videoSinkProvider.setOutputSurfaceInfo(displaySurface, outputResolution);
|
videoSinkProvider.setOutputSurfaceInfo(displaySurface, outputResolution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
// Set videoSink back to null so that, if the try block fails and the renderer retries the
|
|
||||||
// codec initialization, the try block is re-executed.
|
|
||||||
videoSink = null;
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
hasInitializedPlayback = true;
|
hasInitializedPlayback = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user