Rollback of fdfe631850
*** Original commit *** Remove null-ness of muxedCaptionFormats list Pre-work for removing HlsMasterPlaylist and HlsPlaylistParser from null-checking blacklist. *** PiperOrigin-RevId: 274591502
This commit is contained in:
parent
fdfe631850
commit
3eea797069
@ -635,8 +635,10 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
|
||||
/* isPrimaryTrackInVariant= */ false)));
|
||||
}
|
||||
List<Format> ccFormats = masterPlaylist.muxedCaptionFormats;
|
||||
for (int i = 0; i < ccFormats.size(); i++) {
|
||||
muxedTrackGroups.add(new TrackGroup(ccFormats.get(i)));
|
||||
if (ccFormats != null) {
|
||||
for (int i = 0; i < ccFormats.size(); i++) {
|
||||
muxedTrackGroups.add(new TrackGroup(ccFormats.get(i)));
|
||||
}
|
||||
}
|
||||
} else if (variantsContainAudioCodecs) {
|
||||
// Variants only contain audio.
|
||||
|
@ -177,7 +177,8 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
|
||||
@Nullable public final Format muxedAudioFormat;
|
||||
/**
|
||||
* The format of the closed captions declared by the playlist. May be empty if the playlist
|
||||
* doesn't declare any caption information or explicitly declares no captions are available.
|
||||
* explicitly declares no captions are available, or null if the playlist does not declare any
|
||||
* captions information.
|
||||
*/
|
||||
public final List<Format> muxedCaptionFormats;
|
||||
/** Contains variable definitions, as defined by the #EXT-X-DEFINE tag. */
|
||||
@ -222,7 +223,8 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
|
||||
this.subtitles = Collections.unmodifiableList(subtitles);
|
||||
this.closedCaptions = Collections.unmodifiableList(closedCaptions);
|
||||
this.muxedAudioFormat = muxedAudioFormat;
|
||||
this.muxedCaptionFormats = Collections.unmodifiableList(muxedCaptionFormats);
|
||||
this.muxedCaptionFormats = muxedCaptionFormats != null
|
||||
? Collections.unmodifiableList(muxedCaptionFormats) : null;
|
||||
this.variableDefinitions = Collections.unmodifiableMap(variableDefinitions);
|
||||
this.sessionKeyDrmInitData = Collections.unmodifiableList(sessionKeyDrmInitData);
|
||||
}
|
||||
@ -264,7 +266,7 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
|
||||
/* subtitles= */ Collections.emptyList(),
|
||||
/* closedCaptions= */ Collections.emptyList(),
|
||||
/* muxedAudioFormat= */ null,
|
||||
/* muxedCaptionFormats= */ Collections.emptyList(),
|
||||
/* muxedCaptionFormats= */ null,
|
||||
/* hasIndependentSegments= */ false,
|
||||
/* variableDefinitions= */ Collections.emptyMap(),
|
||||
/* sessionKeyDrmInitData= */ Collections.emptyList());
|
||||
|
@ -267,7 +267,7 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
||||
ArrayList<DrmInitData> sessionKeyDrmInitData = new ArrayList<>();
|
||||
ArrayList<String> tags = new ArrayList<>();
|
||||
Format muxedAudioFormat = null;
|
||||
List<Format> muxedCaptionFormats = new ArrayList<>();
|
||||
List<Format> muxedCaptionFormats = null;
|
||||
boolean noClosedCaptions = false;
|
||||
boolean hasIndependentSegmentsTag = false;
|
||||
|
||||
@ -494,6 +494,9 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
||||
mimeType = MimeTypes.APPLICATION_CEA708;
|
||||
accessibilityChannel = Integer.parseInt(instreamId.substring(7));
|
||||
}
|
||||
if (muxedCaptionFormats == null) {
|
||||
muxedCaptionFormats = new ArrayList<>();
|
||||
}
|
||||
muxedCaptionFormats.add(
|
||||
Format.createTextContainerFormat(
|
||||
/* id= */ formatId,
|
||||
@ -515,7 +518,7 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
||||
}
|
||||
|
||||
if (noClosedCaptions) {
|
||||
muxedCaptionFormats.clear();
|
||||
muxedCaptionFormats = Collections.emptyList();
|
||||
}
|
||||
|
||||
return new HlsMasterPlaylist(
|
||||
|
@ -200,7 +200,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
|
||||
List<HlsMasterPlaylist.Variant> variants = masterPlaylist.variants;
|
||||
assertThat(variants).hasSize(5);
|
||||
assertThat(masterPlaylist.muxedCaptionFormats).isEmpty();
|
||||
assertThat(masterPlaylist.muxedCaptionFormats).isNull();
|
||||
|
||||
assertThat(variants.get(0).format.bitrate).isEqualTo(1280000);
|
||||
assertThat(variants.get(0).format.codecs).isEqualTo("mp4a.40.2,avc1.66.30");
|
||||
|
@ -456,7 +456,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
/* subtitles= */ Collections.emptyList(),
|
||||
/* closedCaptions= */ Collections.emptyList(),
|
||||
/* muxedAudioFormat= */ null,
|
||||
/* muxedCaptionFormats= */ Collections.emptyList(),
|
||||
/* muxedCaptionFormats= */ null,
|
||||
/* hasIndependentSegments= */ true,
|
||||
/* variableDefinitions= */ Collections.emptyMap(),
|
||||
/* sessionKeyDrmInitData= */ Collections.emptyList());
|
||||
|
Loading…
x
Reference in New Issue
Block a user