mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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(
|
private Extractor createExtractorByFileExtension(
|
||||||
Uri uri,
|
Uri uri,
|
||||||
Format format,
|
Format format,
|
||||||
List<Format> muxedCaptionFormats,
|
@Nullable List<Format> muxedCaptionFormats,
|
||||||
DrmInitData drmInitData,
|
@Nullable DrmInitData drmInitData,
|
||||||
TimestampAdjuster timestampAdjuster) {
|
TimestampAdjuster timestampAdjuster) {
|
||||||
String lastPathSegment = uri.getLastPathSegment();
|
String lastPathSegment = uri.getLastPathSegment();
|
||||||
if (lastPathSegment == null) {
|
if (lastPathSegment == null) {
|
||||||
|
|
@ -226,7 +226,7 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
||||||
@DefaultTsPayloadReaderFactory.Flags int userProvidedPayloadReaderFactoryFlags,
|
@DefaultTsPayloadReaderFactory.Flags int userProvidedPayloadReaderFactoryFlags,
|
||||||
boolean exposeCea608WhenMissingDeclarations,
|
boolean exposeCea608WhenMissingDeclarations,
|
||||||
Format format,
|
Format format,
|
||||||
List<Format> muxedCaptionFormats,
|
@Nullable List<Format> muxedCaptionFormats,
|
||||||
TimestampAdjuster timestampAdjuster) {
|
TimestampAdjuster timestampAdjuster) {
|
||||||
@DefaultTsPayloadReaderFactory.Flags
|
@DefaultTsPayloadReaderFactory.Flags
|
||||||
int payloadReaderFactoryFlags =
|
int payloadReaderFactoryFlags =
|
||||||
|
|
@ -270,26 +270,34 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
||||||
private static FragmentedMp4Extractor createFragmentedMp4Extractor(
|
private static FragmentedMp4Extractor createFragmentedMp4Extractor(
|
||||||
TimestampAdjuster timestampAdjuster,
|
TimestampAdjuster timestampAdjuster,
|
||||||
Format format,
|
Format format,
|
||||||
DrmInitData drmInitData,
|
@Nullable DrmInitData drmInitData,
|
||||||
@Nullable List<Format> muxedCaptionFormats) {
|
@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
|
// 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.
|
// creating a separate EMSG track for every audio track in a video stream.
|
||||||
return new FragmentedMp4Extractor(
|
return new FragmentedMp4Extractor(
|
||||||
/* flags= */ isVariant ? FragmentedMp4Extractor.FLAG_ENABLE_EMSG_TRACK : 0,
|
/* flags= */ isFmp4Variant(format) ? FragmentedMp4Extractor.FLAG_ENABLE_EMSG_TRACK : 0,
|
||||||
timestampAdjuster,
|
timestampAdjuster,
|
||||||
/* sideloadedTrack= */ null,
|
/* sideloadedTrack= */ null,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
muxedCaptionFormats != null ? muxedCaptionFormats : Collections.emptyList());
|
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(
|
private static Result buildResultForSameExtractorType(
|
||||||
Extractor previousExtractor, Format format, TimestampAdjuster timestampAdjuster) {
|
Extractor previousExtractor, Format format, TimestampAdjuster timestampAdjuster) {
|
||||||
if (previousExtractor instanceof WebvttExtractor) {
|
if (previousExtractor instanceof WebvttExtractor) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue