Commit caa90844 by aquilescanta Committed by Oliver Woodman

Allow overridable empty closed caption format list in DefaultTsPayloadReaderFactory

Issue:#4451

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202923630
parent c23910ad
...@@ -61,7 +61,10 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact ...@@ -61,7 +61,10 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
* readers. * readers.
*/ */
public DefaultTsPayloadReaderFactory(@Flags int flags) { public DefaultTsPayloadReaderFactory(@Flags int flags) {
this(flags, Collections.<Format>emptyList()); this(
flags,
Collections.singletonList(
Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608, 0, null)));
} }
/** /**
...@@ -76,10 +79,6 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact ...@@ -76,10 +79,6 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
*/ */
public DefaultTsPayloadReaderFactory(@Flags int flags, List<Format> closedCaptionFormats) { public DefaultTsPayloadReaderFactory(@Flags int flags, List<Format> closedCaptionFormats) {
this.flags = flags; this.flags = flags;
if (!isSet(FLAG_OVERRIDE_CAPTION_DESCRIPTORS) && closedCaptionFormats.isEmpty()) {
closedCaptionFormats = Collections.singletonList(Format.createTextSampleFormat(null,
MimeTypes.APPLICATION_CEA608, 0, null));
}
this.closedCaptionFormats = closedCaptionFormats; this.closedCaptionFormats = closedCaptionFormats;
} }
......
...@@ -93,7 +93,11 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory { ...@@ -93,7 +93,11 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
// The playlist declares closed caption renditions, we should ignore descriptors. // The playlist declares closed caption renditions, we should ignore descriptors.
esReaderFactoryFlags |= DefaultTsPayloadReaderFactory.FLAG_OVERRIDE_CAPTION_DESCRIPTORS; esReaderFactoryFlags |= DefaultTsPayloadReaderFactory.FLAG_OVERRIDE_CAPTION_DESCRIPTORS;
} else { } else {
muxedCaptionFormats = Collections.emptyList(); // The playlist does not provide any closed caption information. We preemptively declare a
// closed caption track on channel 0.
muxedCaptionFormats =
Collections.singletonList(
Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608, 0, null));
} }
String codecs = format.codecs; String codecs = format.codecs;
if (!TextUtils.isEmpty(codecs)) { if (!TextUtils.isEmpty(codecs)) {
......
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