mirror of
https://github.com/samsonjs/media.git
synced 2026-03-31 10:25:48 +00:00
Add nullness annotations to MediaPeriodQueue
#fixit PiperOrigin-RevId: 559395027
This commit is contained in:
parent
404a259295
commit
2ad37d2e37
1 changed files with 7 additions and 7 deletions
|
|
@ -16,6 +16,7 @@
|
|||
package androidx.media3.exoplayer;
|
||||
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||
import static java.lang.Math.max;
|
||||
|
||||
import android.os.Handler;
|
||||
|
|
@ -241,10 +242,9 @@ import com.google.common.collect.ImmutableList;
|
|||
* @return The updated reading period holder.
|
||||
*/
|
||||
public MediaPeriodHolder advanceReadingPeriod() {
|
||||
Assertions.checkState(reading != null && reading.getNext() != null);
|
||||
reading = reading.getNext();
|
||||
reading = checkStateNotNull(reading).getNext();
|
||||
notifyQueueUpdate();
|
||||
return reading;
|
||||
return checkStateNotNull(reading);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -282,14 +282,14 @@ import com.google.common.collect.ImmutableList;
|
|||
* @return Whether the reading period has been removed.
|
||||
*/
|
||||
public boolean removeAfter(MediaPeriodHolder mediaPeriodHolder) {
|
||||
Assertions.checkState(mediaPeriodHolder != null);
|
||||
checkStateNotNull(mediaPeriodHolder);
|
||||
if (mediaPeriodHolder.equals(loading)) {
|
||||
return false;
|
||||
}
|
||||
boolean removedReading = false;
|
||||
loading = mediaPeriodHolder;
|
||||
while (mediaPeriodHolder.getNext() != null) {
|
||||
mediaPeriodHolder = mediaPeriodHolder.getNext();
|
||||
mediaPeriodHolder = checkNotNull(mediaPeriodHolder.getNext());
|
||||
if (mediaPeriodHolder == reading) {
|
||||
reading = playing;
|
||||
removedReading = true;
|
||||
|
|
@ -297,7 +297,7 @@ import com.google.common.collect.ImmutableList;
|
|||
mediaPeriodHolder.release();
|
||||
length--;
|
||||
}
|
||||
loading.setNext(null);
|
||||
checkNotNull(loading).setNext(null);
|
||||
notifyQueueUpdate();
|
||||
return removedReading;
|
||||
}
|
||||
|
|
@ -644,7 +644,7 @@ import com.google.common.collect.ImmutableList;
|
|||
int nextPeriodIndex =
|
||||
timeline.getNextPeriodIndex(
|
||||
currentPeriodIndex, period, window, repeatMode, shuffleModeEnabled);
|
||||
while (lastValidPeriodHolder.getNext() != null
|
||||
while (checkNotNull(lastValidPeriodHolder).getNext() != null
|
||||
&& !lastValidPeriodHolder.info.isLastInTimelinePeriod) {
|
||||
lastValidPeriodHolder = lastValidPeriodHolder.getNext();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue