diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index 4643779e68..194fd89083 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -1014,7 +1014,7 @@ import java.util.concurrent.atomic.AtomicBoolean; maybeContinueLoading(); } else { // New period has not been prepared. - queue.clear(/* keepFrontPeriodUid= */ true); + queue.clear(); resetRendererPosition(periodPositionUs); } @@ -1139,7 +1139,7 @@ import java.util.concurrent.atomic.AtomicBoolean; } } - queue.clear(/* keepFrontPeriodUid= */ !clearPlaylist); + queue.clear(); shouldContinueLoading = false; Timeline timeline = playbackInfo.timeline; if (clearPlaylist) { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java index 50a71d7970..f72e83adb5 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java @@ -256,21 +256,14 @@ import com.google.android.exoplayer2.util.Assertions; return removedReading; } - /** - * Clears the queue. - * - * @param keepFrontPeriodUid Whether the queue should keep the id of the media period in the front - * of queue (typically the playing one) for later reuse. - */ - public void clear(boolean keepFrontPeriodUid) { + /** Clears the queue. */ + public void clear() { MediaPeriodHolder front = playing; if (front != null) { - oldFrontPeriodUid = keepFrontPeriodUid ? front.uid : null; + oldFrontPeriodUid = front.uid; oldFrontPeriodWindowSequenceNumber = front.info.id.windowSequenceNumber; removeAfter(front); front.release(); - } else if (!keepFrontPeriodUid) { - oldFrontPeriodUid = null; } playing = null; loading = null;