Fix wrong output timestamp in seeking
Set `VideoSink`'s offset during seeking in `MCVR.onPositionReset()` This one is necessary in some cases, where `onProcessedStreamChange()` is not invoked during a seek. For example, when seeking when playback has ended. PiperOrigin-RevId: 630056723
This commit is contained in:
parent
d059e97b28
commit
2e3c3eb678
@ -652,6 +652,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// Flush the video sink first to ensure it stops reading textures that will be owned by
|
// Flush the video sink first to ensure it stops reading textures that will be owned by
|
||||||
// MediaCodec once the codec is flushed.
|
// MediaCodec once the codec is flushed.
|
||||||
videoSink.flush();
|
videoSink.flush();
|
||||||
|
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
||||||
super.onPositionReset(positionUs, joining);
|
super.onPositionReset(positionUs, joining);
|
||||||
videoFrameReleaseControl.reset();
|
videoFrameReleaseControl.reset();
|
||||||
if (joining) {
|
if (joining) {
|
||||||
@ -1098,7 +1099,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// Pass a direct executor since the callback handling involves posting on the app looper
|
// Pass a direct executor since the callback handling involves posting on the app looper
|
||||||
// again, so there's no need to do two hops.
|
// again, so there's no need to do two hops.
|
||||||
directExecutor());
|
directExecutor());
|
||||||
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
|
||||||
}
|
}
|
||||||
hasInitializedPlayback = true;
|
hasInitializedPlayback = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user