Make renderer flush when setting pause-at-end more targeted.

We currently always reset everything if playingPeriod != readingPeriod.
However, this is only needed when the pausing is actually required, i.e.,
if the feature is enabled and we are in the last period of the window.

PiperOrigin-RevId: 328141242
This commit is contained in:
tonihei 2020-08-24 16:05:59 +01:00 committed by kim-vde
parent 4b0e39e4b9
commit 996e58973d

View File

@ -733,11 +733,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
private void setPauseAtEndOfWindowInternal(boolean pauseAtEndOfWindow) private void setPauseAtEndOfWindowInternal(boolean pauseAtEndOfWindow)
throws ExoPlaybackException { throws ExoPlaybackException {
this.pauseAtEndOfWindow = pauseAtEndOfWindow; this.pauseAtEndOfWindow = pauseAtEndOfWindow;
if (queue.getReadingPeriod() != queue.getPlayingPeriod()) {
seekToCurrentPosition(/* sendDiscontinuity= */ true);
}
resetPendingPauseAtEndOfPeriod(); resetPendingPauseAtEndOfPeriod();
handleLoadingMediaPeriodChanged(/* loadingTrackSelectionChanged= */ false); if (pendingPauseAtEndOfPeriod && queue.getReadingPeriod() != queue.getPlayingPeriod()) {
// When pausing is required, we need to set the streams of the playing period final. If we
// already started reading the next period, we need to flush the renderers.
seekToCurrentPosition(/* sendDiscontinuity= */ true);
handleLoadingMediaPeriodChanged(/* loadingTrackSelectionChanged= */ false);
}
} }
private void setOffloadSchedulingEnabledInternal(boolean offloadSchedulingEnabled) { private void setOffloadSchedulingEnabledInternal(boolean offloadSchedulingEnabled) {