Bypass sniffing for single extractor

Sniffing is performed in ProgressiveMediaPeriod even if a single
extractor is provided. Skip it in that case to improve performances.

Issue:#6325
PiperOrigin-RevId: 266766373
This commit is contained in:
kimvde 2019-09-02 13:43:42 +01:00 committed by Toni
parent aff9e731b2
commit 82d10e2ea8
2 changed files with 22 additions and 13 deletions

View File

@ -2,6 +2,8 @@
### dev-v2 (not yet released) ###
* Bypass sniffing in `ProgressiveMediaPeriod` in case a single extractor is
provided ([#6325](https://github.com/google/ExoPlayer/issues/6325)).
* Surface information provided by methods `isHardwareAccelerated`,
`isSoftwareOnly` and `isVendor` added in Android Q in `MediaCodecInfo` class
([#5839](https://github.com/google/ExoPlayer/issues/5839)).

View File

@ -1068,6 +1068,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
if (extractor != null) {
return extractor;
}
if (extractors.length == 1) {
this.extractor = extractors[0];
} else {
for (Extractor extractor : extractors) {
try {
if (extractor.sniff(input)) {
@ -1081,8 +1084,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
if (extractor == null) {
throw new UnrecognizedInputFormatException("None of the available extractors ("
+ Util.getCommaDelimitedSimpleClassNames(extractors) + ") could read the stream.", uri);
throw new UnrecognizedInputFormatException(
"None of the available extractors ("
+ Util.getCommaDelimitedSimpleClassNames(extractors)
+ ") could read the stream.",
uri);
}
}
extractor.init(output);
return extractor;