Tweak null-handling of trackGroupToSampleQueueIndex in HlsSampleStreamWrapper
PiperOrigin-RevId: 275814023
This commit is contained in:
parent
e43658af1f
commit
3101a5df58
@ -360,19 +360,18 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
streamResetFlags[i] = true;
|
streamResetFlags[i] = true;
|
||||||
if (trackGroupToSampleQueueIndex != null) {
|
if (trackGroupToSampleQueueIndex != null) {
|
||||||
((HlsSampleStream) streams[i]).bindSampleQueue();
|
((HlsSampleStream) streams[i]).bindSampleQueue();
|
||||||
}
|
// If there's still a chance of avoiding a seek, try and seek within the sample queue.
|
||||||
// If there's still a chance of avoiding a seek, try and seek within the sample queue.
|
if (!seekRequired) {
|
||||||
if (sampleQueuesBuilt && !seekRequired) {
|
SampleQueue sampleQueue = sampleQueues[trackGroupToSampleQueueIndex[trackGroupIndex]];
|
||||||
// Must be non-null if sampleQueuesBuilt == true.
|
sampleQueue.rewind();
|
||||||
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
|
// A seek can be avoided if we're able to advance to the current playback position in
|
||||||
SampleQueue sampleQueue = sampleQueues[trackGroupToSampleQueueIndex[trackGroupIndex]];
|
// the sample queue, or if we haven't read anything from the queue since the previous
|
||||||
sampleQueue.rewind();
|
// seek (this case is common for sparse tracks such as metadata tracks). In all other
|
||||||
// A seek can be avoided if we're able to advance to the current playback position in the
|
// cases a seek is required.
|
||||||
// sample queue, or if we haven't read anything from the queue since the previous seek
|
seekRequired =
|
||||||
// (this case is common for sparse tracks such as metadata tracks). In all other cases a
|
sampleQueue.advanceTo(positionUs, true, true) == SampleQueue.ADVANCE_FAILED
|
||||||
// seek is required.
|
&& sampleQueue.getReadIndex() != 0;
|
||||||
seekRequired = sampleQueue.advanceTo(positionUs, true, true) == SampleQueue.ADVANCE_FAILED
|
}
|
||||||
&& sampleQueue.getReadIndex() != 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,7 +998,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
pendingResetUpstreamFormats = false;
|
pendingResetUpstreamFormats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresNonNull("trackGroupToSampleQueueIndex")
|
|
||||||
private void onTracksEnded() {
|
private void onTracksEnded() {
|
||||||
sampleQueuesBuilt = true;
|
sampleQueuesBuilt = true;
|
||||||
maybeFinishPrepare();
|
maybeFinishPrepare();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user