Add some missing local @Nullable annotations

PiperOrigin-RevId: 292564056
This commit is contained in:
olly 2020-01-31 17:56:28 +00:00 committed by Oliver Woodman
parent d287e13d9e
commit a7c6cb4abb
2 changed files with 13 additions and 10 deletions

View file

@ -1111,11 +1111,11 @@ public final class Format implements Parcelable {
int trackType = MimeTypes.getTrackType(sampleMimeType);
// Use manifest value only.
String id = manifestFormat.id;
@Nullable String id = manifestFormat.id;
// Prefer manifest values, but fill in from sample format if missing.
String label = manifestFormat.label != null ? manifestFormat.label : this.label;
String language = this.language;
@Nullable String label = manifestFormat.label != null ? manifestFormat.label : this.label;
@Nullable String language = this.language;
if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
&& manifestFormat.language != null) {
language = manifestFormat.language;
@ -1123,7 +1123,7 @@ public final class Format implements Parcelable {
// Prefer sample format values, but fill in from manifest if missing.
int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
String codecs = this.codecs;
@Nullable String codecs = this.codecs;
if (codecs == null) {
// 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.
@ -1133,6 +1133,7 @@ public final class Format implements Parcelable {
}
}
@Nullable
Metadata metadata =
this.metadata == null
? manifestFormat.metadata
@ -1146,6 +1147,7 @@ public final class Format implements Parcelable {
// Merge manifest and sample format values.
@C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
@C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags;
@Nullable
DrmInitData drmInitData =
DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

View file

@ -1009,7 +1009,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private void updateSampleStreams(@NullableType SampleStream[] streams) {
hlsSampleStreams.clear();
for (SampleStream stream : streams) {
for (@Nullable SampleStream stream : streams) {
if (stream != null) {
hlsSampleStreams.add((HlsSampleStream) stream);
}
@ -1118,7 +1118,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
int primaryExtractorTrackIndex = C.INDEX_UNSET;
int extractorTrackCount = sampleQueues.length;
for (int i = 0; i < extractorTrackCount; i++) {
String sampleMimeType = sampleQueues[i].getUpstreamFormat().sampleMimeType;
@Nullable String sampleMimeType = sampleQueues[i].getUpstreamFormat().sampleMimeType;
int trackType;
if (MimeTypes.isVideo(sampleMimeType)) {
trackType = C.TRACK_TYPE_VIDEO;
@ -1166,6 +1166,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
trackGroups[i] = new TrackGroup(formats);
primaryTrackGroupIndex = i;
} else {
@Nullable
Format trackFormat =
primaryExtractorTrackType == C.TRACK_TYPE_VIDEO
&& MimeTypes.isAudio(sampleFormat.sampleMimeType)
@ -1280,8 +1281,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
? playlistFormat.channelCount
: sampleFormat.channelCount;
int sampleTrackType = MimeTypes.getTrackType(sampleFormat.sampleMimeType);
String codecs = Util.getCodecsOfType(playlistFormat.codecs, sampleTrackType);
String mimeType = MimeTypes.getMediaMimeType(codecs);
@Nullable String codecs = Util.getCodecsOfType(playlistFormat.codecs, sampleTrackType);
@Nullable String mimeType = MimeTypes.getMediaMimeType(codecs);
if (mimeType == null) {
mimeType = sampleFormat.sampleMimeType;
}
@ -1304,8 +1305,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
private static boolean formatsMatch(Format manifestFormat, Format sampleFormat) {
String manifestFormatMimeType = manifestFormat.sampleMimeType;
String sampleFormatMimeType = sampleFormat.sampleMimeType;
@Nullable String manifestFormatMimeType = manifestFormat.sampleMimeType;
@Nullable String sampleFormatMimeType = sampleFormat.sampleMimeType;
int manifestFormatTrackType = MimeTypes.getTrackType(manifestFormatMimeType);
if (manifestFormatTrackType != C.TRACK_TYPE_TEXT) {
return manifestFormatTrackType == MimeTypes.getTrackType(sampleFormatMimeType);