Skip to content

Commit

Permalink
Bypass sniffing for single extractor
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kim-vde authored and tonihei committed Sep 5, 2019
1 parent aff9e73 commit 82d10e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,21 +1068,28 @@ public Extractor selectExtractor(ExtractorInput input, ExtractorOutput output, U
if (extractor != null) {
return extractor;
}
for (Extractor extractor : extractors) {
try {
if (extractor.sniff(input)) {
this.extractor = extractor;
break;
if (extractors.length == 1) {
this.extractor = extractors[0];
} else {
for (Extractor extractor : extractors) {
try {
if (extractor.sniff(input)) {
this.extractor = extractor;
break;
}
} catch (EOFException e) {
// Do nothing.
} finally {
input.resetPeekPosition();
}
} catch (EOFException e) {
// Do nothing.
} finally {
input.resetPeekPosition();
}
}
if (extractor == null) {
throw new UnrecognizedInputFormatException("None of the available extractors ("
+ Util.getCommaDelimitedSimpleClassNames(extractors) + ") could read the stream.", uri);
if (extractor == null) {
throw new UnrecognizedInputFormatException(
"None of the available extractors ("
+ Util.getCommaDelimitedSimpleClassNames(extractors)
+ ") could read the stream.",
uri);
}
}
extractor.init(output);
return extractor;
Expand Down

0 comments on commit 82d10e2

Please sign in to comment.