Fix CTS tests
Broken since behavioral parameters were added.
Test: CTS.
Bug: 150321580
Bug: 147308781
Bug: 149906115
Change-Id: I8629a78e547cba3552bcc73c0dd55b9317611156
diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java
index 11d3a68..6ec5124 100644
--- a/apex/media/framework/java/android/media/MediaParser.java
+++ b/apex/media/framework/java/android/media/MediaParser.java
@@ -700,30 +700,34 @@
mDataSource.mInputReader = seekableInputReader;
// TODO: Apply parameters when creating extractor instances.
- if (mExtractorName != null) {
- mExtractor = EXTRACTOR_FACTORIES_BY_NAME.get(mExtractorName).createInstance();
- } else if (mExtractor == null) {
- for (String parserName : mParserNamesPool) {
- Extractor extractor = EXTRACTOR_FACTORIES_BY_NAME.get(parserName).createInstance();
- try {
- if (extractor.sniff(mExtractorInput)) {
- mExtractorName = parserName;
- mExtractor = extractor;
- mExtractor.init(new ExtractorOutputAdapter());
- break;
+ if (mExtractor == null) {
+ if (mExtractorName != null) {
+ mExtractor = EXTRACTOR_FACTORIES_BY_NAME.get(mExtractorName).createInstance();
+ mExtractor.init(new ExtractorOutputAdapter());
+ } else {
+ for (String parserName : mParserNamesPool) {
+ Extractor extractor =
+ EXTRACTOR_FACTORIES_BY_NAME.get(parserName).createInstance();
+ try {
+ if (extractor.sniff(mExtractorInput)) {
+ mExtractorName = parserName;
+ mExtractor = extractor;
+ mExtractor.init(new ExtractorOutputAdapter());
+ break;
+ }
+ } catch (EOFException e) {
+ // Do nothing.
+ } catch (IOException | InterruptedException e) {
+ throw new IllegalStateException(e);
+ } finally {
+ mExtractorInput.resetPeekPosition();
}
- } catch (EOFException e) {
- // Do nothing.
- } catch (IOException | InterruptedException e) {
- throw new IllegalStateException(e);
- } finally {
- mExtractorInput.resetPeekPosition();
}
+ if (mExtractor == null) {
+ throw UnrecognizedInputFormatException.createForExtractors(mParserNamesPool);
+ }
+ return true;
}
- if (mExtractor == null) {
- throw UnrecognizedInputFormatException.createForExtractors(mParserNamesPool);
- }
- return true;
}
if (isPendingSeek()) {