Commit a7c6cb4a by olly Committed by Oliver Woodman

Add some missing local @Nullable annotations

PiperOrigin-RevId: 292564056
parent d287e13d
...@@ -1111,11 +1111,11 @@ public final class Format implements Parcelable { ...@@ -1111,11 +1111,11 @@ public final class Format implements Parcelable {
int trackType = MimeTypes.getTrackType(sampleMimeType); int trackType = MimeTypes.getTrackType(sampleMimeType);
// Use manifest value only. // Use manifest value only.
String id = manifestFormat.id; @Nullable String id = manifestFormat.id;
// Prefer manifest values, but fill in from sample format if missing. // Prefer manifest values, but fill in from sample format if missing.
String label = manifestFormat.label != null ? manifestFormat.label : this.label; @Nullable String label = manifestFormat.label != null ? manifestFormat.label : this.label;
String language = this.language; @Nullable String language = this.language;
if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO) if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
&& manifestFormat.language != null) { && manifestFormat.language != null) {
language = manifestFormat.language; language = manifestFormat.language;
...@@ -1123,7 +1123,7 @@ public final class Format implements Parcelable { ...@@ -1123,7 +1123,7 @@ public final class Format implements Parcelable {
// Prefer sample format values, but fill in from manifest if missing. // Prefer sample format values, but fill in from manifest if missing.
int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate; int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
String codecs = this.codecs; @Nullable String codecs = this.codecs;
if (codecs == null) { if (codecs == null) {
// The manifest format may be muxed, so filter only codecs of this format's type. If we still // The manifest format may be muxed, so filter only codecs of this format's type. If we still
// have more than one codec then we're unable to uniquely identify which codec to fill in. // have more than one codec then we're unable to uniquely identify which codec to fill in.
...@@ -1133,6 +1133,7 @@ public final class Format implements Parcelable { ...@@ -1133,6 +1133,7 @@ public final class Format implements Parcelable {
} }
} }
@Nullable
Metadata metadata = Metadata metadata =
this.metadata == null this.metadata == null
? manifestFormat.metadata ? manifestFormat.metadata
...@@ -1146,6 +1147,7 @@ public final class Format implements Parcelable { ...@@ -1146,6 +1147,7 @@ public final class Format implements Parcelable {
// Merge manifest and sample format values. // Merge manifest and sample format values.
@C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags; @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
@C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags; @C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags;
@Nullable
DrmInitData drmInitData = DrmInitData drmInitData =
DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData); DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);
......
...@@ -1009,7 +1009,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -1009,7 +1009,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private void updateSampleStreams(@NullableType SampleStream[] streams) { private void updateSampleStreams(@NullableType SampleStream[] streams) {
hlsSampleStreams.clear(); hlsSampleStreams.clear();
for (SampleStream stream : streams) { for (@Nullable SampleStream stream : streams) {
if (stream != null) { if (stream != null) {
hlsSampleStreams.add((HlsSampleStream) stream); hlsSampleStreams.add((HlsSampleStream) stream);
} }
...@@ -1118,7 +1118,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -1118,7 +1118,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
int primaryExtractorTrackIndex = C.INDEX_UNSET; int primaryExtractorTrackIndex = C.INDEX_UNSET;
int extractorTrackCount = sampleQueues.length; int extractorTrackCount = sampleQueues.length;
for (int i = 0; i < extractorTrackCount; i++) { for (int i = 0; i < extractorTrackCount; i++) {
String sampleMimeType = sampleQueues[i].getUpstreamFormat().sampleMimeType; @Nullable String sampleMimeType = sampleQueues[i].getUpstreamFormat().sampleMimeType;
int trackType; int trackType;
if (MimeTypes.isVideo(sampleMimeType)) { if (MimeTypes.isVideo(sampleMimeType)) {
trackType = C.TRACK_TYPE_VIDEO; trackType = C.TRACK_TYPE_VIDEO;
...@@ -1166,6 +1166,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -1166,6 +1166,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
trackGroups[i] = new TrackGroup(formats); trackGroups[i] = new TrackGroup(formats);
primaryTrackGroupIndex = i; primaryTrackGroupIndex = i;
} else { } else {
@Nullable
Format trackFormat = Format trackFormat =
primaryExtractorTrackType == C.TRACK_TYPE_VIDEO primaryExtractorTrackType == C.TRACK_TYPE_VIDEO
&& MimeTypes.isAudio(sampleFormat.sampleMimeType) && MimeTypes.isAudio(sampleFormat.sampleMimeType)
...@@ -1280,8 +1281,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -1280,8 +1281,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
? playlistFormat.channelCount ? playlistFormat.channelCount
: sampleFormat.channelCount; : sampleFormat.channelCount;
int sampleTrackType = MimeTypes.getTrackType(sampleFormat.sampleMimeType); int sampleTrackType = MimeTypes.getTrackType(sampleFormat.sampleMimeType);
String codecs = Util.getCodecsOfType(playlistFormat.codecs, sampleTrackType); @Nullable String codecs = Util.getCodecsOfType(playlistFormat.codecs, sampleTrackType);
String mimeType = MimeTypes.getMediaMimeType(codecs); @Nullable String mimeType = MimeTypes.getMediaMimeType(codecs);
if (mimeType == null) { if (mimeType == null) {
mimeType = sampleFormat.sampleMimeType; mimeType = sampleFormat.sampleMimeType;
} }
...@@ -1304,8 +1305,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -1304,8 +1305,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
} }
private static boolean formatsMatch(Format manifestFormat, Format sampleFormat) { private static boolean formatsMatch(Format manifestFormat, Format sampleFormat) {
String manifestFormatMimeType = manifestFormat.sampleMimeType; @Nullable String manifestFormatMimeType = manifestFormat.sampleMimeType;
String sampleFormatMimeType = sampleFormat.sampleMimeType; @Nullable String sampleFormatMimeType = sampleFormat.sampleMimeType;
int manifestFormatTrackType = MimeTypes.getTrackType(manifestFormatMimeType); int manifestFormatTrackType = MimeTypes.getTrackType(manifestFormatMimeType);
if (manifestFormatTrackType != C.TRACK_TYPE_TEXT) { if (manifestFormatTrackType != C.TRACK_TYPE_TEXT) {
return manifestFormatTrackType == MimeTypes.getTrackType(sampleFormatMimeType); return manifestFormatTrackType == MimeTypes.getTrackType(sampleFormatMimeType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment