Commit c898e719 by kimvde Committed by kim-vde

Read until the track formats are available in TestUtil.extractSeekMap()

Otherwise, some extractor tests are seeking without making sure that the
extractor has retrieved the formats.

This is needed for PR Issue: #7378.

PiperOrigin-RevId: 335934326
parent 0a9b11d3
...@@ -297,7 +297,8 @@ public class TestUtil { ...@@ -297,7 +297,8 @@ public class TestUtil {
/** /**
* Reads from the given input using the given {@link Extractor}, until it can produce the {@link * Reads from the given input using the given {@link Extractor}, until it can produce the {@link
* SeekMap} and all of the tracks have been identified, or until the extractor encounters EOF. * SeekMap} and all of the track formats have been identified, or until the extractor encounters
* EOF.
* *
* @param extractor The {@link Extractor} to extractor from input. * @param extractor The {@link Extractor} to extractor from input.
* @param output The {@link FakeTrackOutput} to store the extracted {@link SeekMap} and track. * @param output The {@link FakeTrackOutput} to store the extracted {@link SeekMap} and track.
...@@ -316,11 +317,18 @@ public class TestUtil { ...@@ -316,11 +317,18 @@ public class TestUtil {
int readResult = Extractor.RESULT_CONTINUE; int readResult = Extractor.RESULT_CONTINUE;
while (true) { while (true) {
try { try {
// Keep reading until we can get the seek map // Keep reading until we get the seek map and the track information.
while (readResult == Extractor.RESULT_CONTINUE while (readResult == Extractor.RESULT_CONTINUE
&& (output.seekMap == null || !output.tracksEnded)) { && (output.seekMap == null || !output.tracksEnded)) {
readResult = extractor.read(input, positionHolder); readResult = extractor.read(input, positionHolder);
} }
for (int i = 0; i < output.trackOutputs.size(); i++) {
int trackId = output.trackOutputs.keyAt(i);
while (readResult == Extractor.RESULT_CONTINUE
&& output.trackOutputs.get(trackId).lastFormat == null) {
readResult = extractor.read(input, positionHolder);
}
}
} finally { } finally {
Util.closeQuietly(dataSource); Util.closeQuietly(dataSource);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment