mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Always call onProcessedStreamChanged for first stream for effects
Before this CL: - MediaCodecVideoRenderer.onProcessedStreamChanged was called for the first stream in CompositionPlayer. - MediaCodecVideoRenderer.onProcessedStreamChanged was NOT called for the first stream in ExoPlayer.setVideoEffects. This discrepancy was adding some complexity to the code, making it less robust. PiperOrigin-RevId: 735439320
This commit is contained in:
parent
e8842b939c
commit
ce59680d0f
@ -935,6 +935,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
if (wakeupListener != null) {
|
||||
videoSink.setWakeupListener(wakeupListener);
|
||||
}
|
||||
experimentalEnableProcessedStreamChangedAtStart();
|
||||
} else {
|
||||
videoFrameReleaseControl.setClock(getClock());
|
||||
int firstFrameReleaseInstruction =
|
||||
@ -962,13 +963,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
MediaSource.MediaPeriodId mediaPeriodId)
|
||||
throws ExoPlaybackException {
|
||||
super.onStreamChanged(formats, startPositionUs, offsetUs, mediaPeriodId);
|
||||
if (this.startPositionUs == C.TIME_UNSET) {
|
||||
this.startPositionUs = startPositionUs;
|
||||
if (videoSink != null) {
|
||||
videoSink.setStreamStartPositionUs(getOutputStreamStartPositionUs());
|
||||
videoSink.setBufferTimestampAdjustmentUs(getBufferTimestampAdjustmentUs());
|
||||
}
|
||||
}
|
||||
updatePeriodDurationUs(mediaPeriodId);
|
||||
}
|
||||
|
||||
@ -992,7 +986,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
// MediaCodec once the codec is flushed.
|
||||
videoSink.flush(/* resetPosition= */ true);
|
||||
}
|
||||
pendingVideoSinkInputStreamChange = true;
|
||||
}
|
||||
super.onPositionReset(positionUs, joining);
|
||||
if (videoSink == null) {
|
||||
@ -1869,6 +1862,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
// Signaling end of the previous stream.
|
||||
videoSink.signalEndOfCurrentInputStream();
|
||||
videoSink.setStreamStartPositionUs(getOutputStreamStartPositionUs());
|
||||
if (this.startPositionUs == C.TIME_UNSET) {
|
||||
this.startPositionUs = getOutputStreamStartPositionUs();
|
||||
}
|
||||
videoSink.setBufferTimestampAdjustmentUs(getBufferTimestampAdjustmentUs());
|
||||
} else {
|
||||
videoFrameReleaseControl.onStreamChanged(RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED);
|
||||
|
@ -329,7 +329,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
this.bufferingVideoSink = bufferingVideoSink;
|
||||
this.requestToneMapping = requestToneMapping;
|
||||
this.pendingEffects = ImmutableList.of();
|
||||
experimentalEnableProcessedStreamChangedAtStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user