mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00:00
Remove DefaultHlsExtractorFactory from null-checking blacklist
PiperOrigin-RevId: 274537528
This commit is contained in:
parent
b71b9f7c58
commit
6ebcac3883
1 changed files with 21 additions and 13 deletions
|
|
@ -185,8 +185,8 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
|||
private Extractor createExtractorByFileExtension(
|
||||
Uri uri,
|
||||
Format format,
|
||||
List<Format> muxedCaptionFormats,
|
||||
DrmInitData drmInitData,
|
||||
@Nullable List<Format> muxedCaptionFormats,
|
||||
@Nullable DrmInitData drmInitData,
|
||||
TimestampAdjuster timestampAdjuster) {
|
||||
String lastPathSegment = uri.getLastPathSegment();
|
||||
if (lastPathSegment == null) {
|
||||
|
|
@ -226,7 +226,7 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
|||
@DefaultTsPayloadReaderFactory.Flags int userProvidedPayloadReaderFactoryFlags,
|
||||
boolean exposeCea608WhenMissingDeclarations,
|
||||
Format format,
|
||||
List<Format> muxedCaptionFormats,
|
||||
@Nullable List<Format> muxedCaptionFormats,
|
||||
TimestampAdjuster timestampAdjuster) {
|
||||
@DefaultTsPayloadReaderFactory.Flags
|
||||
int payloadReaderFactoryFlags =
|
||||
|
|
@ -270,26 +270,34 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
|||
private static FragmentedMp4Extractor createFragmentedMp4Extractor(
|
||||
TimestampAdjuster timestampAdjuster,
|
||||
Format format,
|
||||
DrmInitData drmInitData,
|
||||
@Nullable DrmInitData drmInitData,
|
||||
@Nullable List<Format> muxedCaptionFormats) {
|
||||
boolean isVariant = false;
|
||||
for (int i = 0; i < format.metadata.length(); i++) {
|
||||
Metadata.Entry entry = format.metadata.get(i);
|
||||
if (entry instanceof HlsTrackMetadataEntry) {
|
||||
isVariant = !((HlsTrackMetadataEntry) entry).variantInfos.isEmpty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Only enable the EMSG TrackOutput if this is the 'variant' track (i.e. the main one) to avoid
|
||||
// creating a separate EMSG track for every audio track in a video stream.
|
||||
return new FragmentedMp4Extractor(
|
||||
/* flags= */ isVariant ? FragmentedMp4Extractor.FLAG_ENABLE_EMSG_TRACK : 0,
|
||||
/* flags= */ isFmp4Variant(format) ? FragmentedMp4Extractor.FLAG_ENABLE_EMSG_TRACK : 0,
|
||||
timestampAdjuster,
|
||||
/* sideloadedTrack= */ null,
|
||||
drmInitData,
|
||||
muxedCaptionFormats != null ? muxedCaptionFormats : Collections.emptyList());
|
||||
}
|
||||
|
||||
/** Returns true if this {@code format} represents a 'variant' track (i.e. the main one). */
|
||||
private static boolean isFmp4Variant(Format format) {
|
||||
Metadata metadata = format.metadata;
|
||||
if (metadata == null) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < metadata.length(); i++) {
|
||||
Metadata.Entry entry = metadata.get(i);
|
||||
if (entry instanceof HlsTrackMetadataEntry) {
|
||||
return !((HlsTrackMetadataEntry) entry).variantInfos.isEmpty();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Result buildResultForSameExtractorType(
|
||||
Extractor previousExtractor, Format format, TimestampAdjuster timestampAdjuster) {
|
||||
if (previousExtractor instanceof WebvttExtractor) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue