diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java index f9e58e2353..25877d12d6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java @@ -46,12 +46,13 @@ public abstract class Chunk implements Loadable { public final Format trackFormat; /** * One of the {@link C} {@code SELECTION_REASON_*} constants if the chunk belongs to a track. - * {@link C#SELECTION_REASON_UNKNOWN} if the chunk does not belong to a track. + * {@link C#SELECTION_REASON_UNKNOWN} if the chunk does not belong to a track, or if the selection + * reason is unknown. */ public final int trackSelectionReason; /** * Optional data associated with the selection of the track to which this chunk belongs. Null if - * the chunk does not belong to a track. + * the chunk does not belong to a track, or if there is no associated track selection data. */ @Nullable public final Object trackSelectionData; /** diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java index 6af85c07ac..5fa85a33e3 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java @@ -15,6 +15,7 @@ */ package com.google.android.exoplayer2.source.chunk; +import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.extractor.DefaultExtractorInput; @@ -67,7 +68,7 @@ public class ContainerMediaChunk extends BaseMediaChunk { DataSpec dataSpec, Format trackFormat, int trackSelectionReason, - Object trackSelectionData, + @Nullable Object trackSelectionData, long startTimeUs, long endTimeUs, long clippedStartTimeUs, diff --git a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java index 0ddbebfd17..5ce2e6a1c5 100644 --- a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java +++ b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java @@ -38,6 +38,7 @@ import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.upstream.LoaderErrorThrower; import com.google.android.exoplayer2.upstream.TransferListener; +import com.google.android.exoplayer2.util.Assertions; import java.io.IOException; import java.util.List; @@ -80,7 +81,7 @@ public class DefaultSsChunkSource implements SsChunkSource { private SsManifest manifest; private int currentManifestChunkOffset; - private IOException fatalError; + @Nullable private IOException fatalError; /** * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests. @@ -106,8 +107,11 @@ public class DefaultSsChunkSource implements SsChunkSource { for (int i = 0; i < extractorWrappers.length; i++) { int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i); Format format = streamElement.formats[manifestTrackIndex]; + @Nullable TrackEncryptionBox[] trackEncryptionBoxes = - format.drmInitData != null ? manifest.protectionElement.trackEncryptionBoxes : null; + format.drmInitData != null + ? Assertions.checkNotNull(manifest.protectionElement).trackEncryptionBoxes + : null; int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0; Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale, C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE, @@ -277,7 +281,7 @@ public class DefaultSsChunkSource implements SsChunkSource { long chunkEndTimeUs, long chunkSeekTimeUs, int trackSelectionReason, - Object trackSelectionData, + @Nullable Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) { DataSpec dataSpec = new DataSpec(uri); // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk.