Remove HlsSampleStreamWrapper from the null checking blacklist

PiperOrigin-RevId: 275440589
This commit is contained in:
ibaker 2019-10-18 11:21:42 +01:00 committed by Oliver Woodman
parent 1317851535
commit b7f335c715

View File

@ -145,7 +145,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@MonotonicNonNull private TrackGroupArray trackGroups; @MonotonicNonNull private TrackGroupArray trackGroups;
@MonotonicNonNull private Set<TrackGroup> optionalTrackGroups; @MonotonicNonNull private Set<TrackGroup> optionalTrackGroups;
// Indexed by track group. // Indexed by track group.
private int[] trackGroupToSampleQueueIndex; private int @MonotonicNonNull [] trackGroupToSampleQueueIndex;
private int primaryTrackGroupIndex; private int primaryTrackGroupIndex;
private boolean haveAudioVideoSampleQueues; private boolean haveAudioVideoSampleQueues;
private boolean[] sampleQueuesEnabledStates; private boolean[] sampleQueuesEnabledStates;
@ -262,6 +262,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
public int bindSampleQueueToSampleStream(int trackGroupIndex) { public int bindSampleQueueToSampleStream(int trackGroupIndex) {
assertIsPrepared(); assertIsPrepared();
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex]; int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex];
if (sampleQueueIndex == C.INDEX_UNSET) { if (sampleQueueIndex == C.INDEX_UNSET) {
@ -279,6 +280,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
public void unbindSampleQueue(int trackGroupIndex) { public void unbindSampleQueue(int trackGroupIndex) {
assertIsPrepared(); assertIsPrepared();
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex]; int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex];
Assertions.checkState(sampleQueuesEnabledStates[sampleQueueIndex]); Assertions.checkState(sampleQueuesEnabledStates[sampleQueueIndex]);
sampleQueuesEnabledStates[sampleQueueIndex] = false; sampleQueuesEnabledStates[sampleQueueIndex] = false;
@ -351,6 +353,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
} }
// 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 (sampleQueuesBuilt && !seekRequired) { if (sampleQueuesBuilt && !seekRequired) {
// Must be non-null if sampleQueuesBuilt == true.
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
SampleQueue sampleQueue = sampleQueues[trackGroupToSampleQueueIndex[trackGroupIndex]]; SampleQueue sampleQueue = sampleQueues[trackGroupToSampleQueueIndex[trackGroupIndex]];
sampleQueue.rewind(); sampleQueue.rewind();
// A seek can be avoided if we're able to advance to the current playback position in the // A seek can be avoided if we're able to advance to the current playback position in the
@ -560,7 +564,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
Format trackFormat = Format trackFormat =
chunkIndex < mediaChunks.size() chunkIndex < mediaChunks.size()
? mediaChunks.get(chunkIndex).trackFormat ? mediaChunks.get(chunkIndex).trackFormat
: upstreamTrackFormat; : Assertions.checkNotNull(upstreamTrackFormat);
format = format.copyWithManifestFormatInfo(trackFormat); format = format.copyWithManifestFormatInfo(trackFormat);
} }
formatHolder.format = format; formatHolder.format = format;
@ -985,6 +989,7 @@ 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();
@ -1012,6 +1017,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
} }
@RequiresNonNull("trackGroups") @RequiresNonNull("trackGroups")
@EnsuresNonNull("trackGroupToSampleQueueIndex")
private void mapSampleQueuesToMatchTrackGroups() { private void mapSampleQueuesToMatchTrackGroups() {
int trackGroupCount = trackGroups.length; int trackGroupCount = trackGroups.length;
trackGroupToSampleQueueIndex = new int[trackGroupCount]; trackGroupToSampleQueueIndex = new int[trackGroupCount];
@ -1060,6 +1066,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* unchanged. * unchanged.
* </ul> * </ul>
*/ */
@EnsuresNonNull({"trackGroups", "optionalTrackGroups", "trackGroupToSampleQueueIndex"})
private void buildTracksFromSampleStreams() { private void buildTracksFromSampleStreams() {
// Iterate through the extractor tracks to discover the "primary" track type, and the index // Iterate through the extractor tracks to discover the "primary" track type, and the index
// of the single track of this type. // of the single track of this type.