mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
MCVR: call VideoSink.setStreamTimestampInfo on stream change
The start position and buffer adjustement are only allowed to change when the stream changes so it makes more sense to call setStreamTimestampInfo when the stream changes. This is part of an effort to simplify stream change notification to the video sink, to ease implementation of multi sequences preview. PiperOrigin-RevId: 734062686
This commit is contained in:
parent
ab2affa5a5
commit
377136419d
@ -941,6 +941,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
super.onStreamChanged(formats, startPositionUs, offsetUs, mediaPeriodId);
|
||||
if (this.startPositionUs == C.TIME_UNSET) {
|
||||
this.startPositionUs = startPositionUs;
|
||||
if (videoSink != null) {
|
||||
videoSink.setStreamTimestampInfo(
|
||||
getOutputStreamStartPositionUs(), getBufferTimestampAdjustmentUs());
|
||||
}
|
||||
}
|
||||
updatePeriodDurationUs(mediaPeriodId);
|
||||
}
|
||||
@ -965,8 +969,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
// MediaCodec once the codec is flushed.
|
||||
videoSink.flush(/* resetPosition= */ true);
|
||||
}
|
||||
videoSink.setStreamTimestampInfo(
|
||||
getOutputStreamStartPositionUs(), getBufferTimestampAdjustmentUs());
|
||||
pendingVideoSinkInputStreamChange = true;
|
||||
}
|
||||
super.onPositionReset(positionUs, joining);
|
||||
|
Loading…
x
Reference in New Issue
Block a user