mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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;
|
package androidx.media3.exoplayer;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||||
|
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||||
import static java.lang.Math.max;
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
@ -241,10 +242,9 @@ import com.google.common.collect.ImmutableList;
|
||||||
* @return The updated reading period holder.
|
* @return The updated reading period holder.
|
||||||
*/
|
*/
|
||||||
public MediaPeriodHolder advanceReadingPeriod() {
|
public MediaPeriodHolder advanceReadingPeriod() {
|
||||||
Assertions.checkState(reading != null && reading.getNext() != null);
|
reading = checkStateNotNull(reading).getNext();
|
||||||
reading = reading.getNext();
|
|
||||||
notifyQueueUpdate();
|
notifyQueueUpdate();
|
||||||
return reading;
|
return checkStateNotNull(reading);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -282,14 +282,14 @@ import com.google.common.collect.ImmutableList;
|
||||||
* @return Whether the reading period has been removed.
|
* @return Whether the reading period has been removed.
|
||||||
*/
|
*/
|
||||||
public boolean removeAfter(MediaPeriodHolder mediaPeriodHolder) {
|
public boolean removeAfter(MediaPeriodHolder mediaPeriodHolder) {
|
||||||
Assertions.checkState(mediaPeriodHolder != null);
|
checkStateNotNull(mediaPeriodHolder);
|
||||||
if (mediaPeriodHolder.equals(loading)) {
|
if (mediaPeriodHolder.equals(loading)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean removedReading = false;
|
boolean removedReading = false;
|
||||||
loading = mediaPeriodHolder;
|
loading = mediaPeriodHolder;
|
||||||
while (mediaPeriodHolder.getNext() != null) {
|
while (mediaPeriodHolder.getNext() != null) {
|
||||||
mediaPeriodHolder = mediaPeriodHolder.getNext();
|
mediaPeriodHolder = checkNotNull(mediaPeriodHolder.getNext());
|
||||||
if (mediaPeriodHolder == reading) {
|
if (mediaPeriodHolder == reading) {
|
||||||
reading = playing;
|
reading = playing;
|
||||||
removedReading = true;
|
removedReading = true;
|
||||||
|
|
@ -297,7 +297,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
mediaPeriodHolder.release();
|
mediaPeriodHolder.release();
|
||||||
length--;
|
length--;
|
||||||
}
|
}
|
||||||
loading.setNext(null);
|
checkNotNull(loading).setNext(null);
|
||||||
notifyQueueUpdate();
|
notifyQueueUpdate();
|
||||||
return removedReading;
|
return removedReading;
|
||||||
}
|
}
|
||||||
|
|
@ -644,7 +644,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
int nextPeriodIndex =
|
int nextPeriodIndex =
|
||||||
timeline.getNextPeriodIndex(
|
timeline.getNextPeriodIndex(
|
||||||
currentPeriodIndex, period, window, repeatMode, shuffleModeEnabled);
|
currentPeriodIndex, period, window, repeatMode, shuffleModeEnabled);
|
||||||
while (lastValidPeriodHolder.getNext() != null
|
while (checkNotNull(lastValidPeriodHolder).getNext() != null
|
||||||
&& !lastValidPeriodHolder.info.isLastInTimelinePeriod) {
|
&& !lastValidPeriodHolder.info.isLastInTimelinePeriod) {
|
||||||
lastValidPeriodHolder = lastValidPeriodHolder.getNext();
|
lastValidPeriodHolder = lastValidPeriodHolder.getNext();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue