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) {
|
if (wakeupListener != null) {
|
||||||
videoSink.setWakeupListener(wakeupListener);
|
videoSink.setWakeupListener(wakeupListener);
|
||||||
}
|
}
|
||||||
|
experimentalEnableProcessedStreamChangedAtStart();
|
||||||
} else {
|
} else {
|
||||||
videoFrameReleaseControl.setClock(getClock());
|
videoFrameReleaseControl.setClock(getClock());
|
||||||
int firstFrameReleaseInstruction =
|
int firstFrameReleaseInstruction =
|
||||||
@ -962,13 +963,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
MediaSource.MediaPeriodId mediaPeriodId)
|
MediaSource.MediaPeriodId mediaPeriodId)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
super.onStreamChanged(formats, startPositionUs, offsetUs, mediaPeriodId);
|
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);
|
updatePeriodDurationUs(mediaPeriodId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,7 +986,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// MediaCodec once the codec is flushed.
|
// MediaCodec once the codec is flushed.
|
||||||
videoSink.flush(/* resetPosition= */ true);
|
videoSink.flush(/* resetPosition= */ true);
|
||||||
}
|
}
|
||||||
pendingVideoSinkInputStreamChange = true;
|
|
||||||
}
|
}
|
||||||
super.onPositionReset(positionUs, joining);
|
super.onPositionReset(positionUs, joining);
|
||||||
if (videoSink == null) {
|
if (videoSink == null) {
|
||||||
@ -1869,6 +1862,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// Signaling end of the previous stream.
|
// Signaling end of the previous stream.
|
||||||
videoSink.signalEndOfCurrentInputStream();
|
videoSink.signalEndOfCurrentInputStream();
|
||||||
videoSink.setStreamStartPositionUs(getOutputStreamStartPositionUs());
|
videoSink.setStreamStartPositionUs(getOutputStreamStartPositionUs());
|
||||||
|
if (this.startPositionUs == C.TIME_UNSET) {
|
||||||
|
this.startPositionUs = getOutputStreamStartPositionUs();
|
||||||
|
}
|
||||||
videoSink.setBufferTimestampAdjustmentUs(getBufferTimestampAdjustmentUs());
|
videoSink.setBufferTimestampAdjustmentUs(getBufferTimestampAdjustmentUs());
|
||||||
} else {
|
} else {
|
||||||
videoFrameReleaseControl.onStreamChanged(RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED);
|
videoFrameReleaseControl.onStreamChanged(RELEASE_FIRST_FRAME_WHEN_PREVIOUS_STREAM_PROCESSED);
|
||||||
|
@ -329,7 +329,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
this.bufferingVideoSink = bufferingVideoSink;
|
this.bufferingVideoSink = bufferingVideoSink;
|
||||||
this.requestToneMapping = requestToneMapping;
|
this.requestToneMapping = requestToneMapping;
|
||||||
this.pendingEffects = ImmutableList.of();
|
this.pendingEffects = ImmutableList.of();
|
||||||
experimentalEnableProcessedStreamChangedAtStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user