Skip to content

Commit

Permalink
Remove HlsSampleStreamWrapper from the null checking blacklist
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 275440589
  • Loading branch information
icbaker authored and ojw28 committed Oct 18, 2019
1 parent 1317851 commit b7f335c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public interface Callback extends SequenceableLoader.Callback<HlsSampleStreamWra
@MonotonicNonNull private TrackGroupArray trackGroups;
@MonotonicNonNull private Set<TrackGroup> optionalTrackGroups;
// Indexed by track group.
private int[] trackGroupToSampleQueueIndex;
private int @MonotonicNonNull [] trackGroupToSampleQueueIndex;
private int primaryTrackGroupIndex;
private boolean haveAudioVideoSampleQueues;
private boolean[] sampleQueuesEnabledStates;
Expand Down Expand Up @@ -262,6 +262,7 @@ public int getPrimaryTrackGroupIndex() {

public int bindSampleQueueToSampleStream(int trackGroupIndex) {
assertIsPrepared();
Assertions.checkNotNull(trackGroupToSampleQueueIndex);

int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex];
if (sampleQueueIndex == C.INDEX_UNSET) {
Expand All @@ -279,6 +280,7 @@ public int bindSampleQueueToSampleStream(int trackGroupIndex) {

public void unbindSampleQueue(int trackGroupIndex) {
assertIsPrepared();
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
int sampleQueueIndex = trackGroupToSampleQueueIndex[trackGroupIndex];
Assertions.checkState(sampleQueuesEnabledStates[sampleQueueIndex]);
sampleQueuesEnabledStates[sampleQueueIndex] = false;
Expand Down Expand Up @@ -351,6 +353,8 @@ public boolean selectTracks(
}
// If there's still a chance of avoiding a seek, try and seek within the sample queue.
if (sampleQueuesBuilt && !seekRequired) {
// Must be non-null if sampleQueuesBuilt == true.
Assertions.checkNotNull(trackGroupToSampleQueueIndex);
SampleQueue sampleQueue = sampleQueues[trackGroupToSampleQueueIndex[trackGroupIndex]];
sampleQueue.rewind();
// A seek can be avoided if we're able to advance to the current playback position in the
Expand Down Expand Up @@ -560,7 +564,7 @@ && finishedReadingChunk(mediaChunks.get(discardToMediaChunkIndex))) {
Format trackFormat =
chunkIndex < mediaChunks.size()
? mediaChunks.get(chunkIndex).trackFormat
: upstreamTrackFormat;
: Assertions.checkNotNull(upstreamTrackFormat);
format = format.copyWithManifestFormatInfo(trackFormat);
}
formatHolder.format = format;
Expand Down Expand Up @@ -985,6 +989,7 @@ private void resetSampleQueues() {
pendingResetUpstreamFormats = false;
}

@RequiresNonNull("trackGroupToSampleQueueIndex")
private void onTracksEnded() {
sampleQueuesBuilt = true;
maybeFinishPrepare();
Expand Down Expand Up @@ -1012,6 +1017,7 @@ private void maybeFinishPrepare() {
}

@RequiresNonNull("trackGroups")
@EnsuresNonNull("trackGroupToSampleQueueIndex")
private void mapSampleQueuesToMatchTrackGroups() {
int trackGroupCount = trackGroups.length;
trackGroupToSampleQueueIndex = new int[trackGroupCount];
Expand Down Expand Up @@ -1060,6 +1066,7 @@ private void mapSampleQueuesToMatchTrackGroups() {
* unchanged.
* </ul>
*/
@EnsuresNonNull({"trackGroups", "optionalTrackGroups", "trackGroupToSampleQueueIndex"})
private void buildTracksFromSampleStreams() {
// Iterate through the extractor tracks to discover the "primary" track type, and the index
// of the single track of this type.
Expand Down

0 comments on commit b7f335c

Please sign in to comment.