mirror of
https://github.com/androidx/media.git
synced 2025-05-11 01:31:40 +08:00
Always keep front period uid in MediaPeriodQueue.
Since we have the Playlist layer on top, it's always guaranteed that a new playlist item has a new uid. So we can just keep the old one in all cases and don't have to be careful to delete it. The deletion was necessary previously in case multiple MediaSources use the same uids. PiperOrigin-RevId: 291152349
This commit is contained in:
parent
0f63c501a8
commit
23f316d67e
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user