Commit abaa4f1a by olly Committed by Oliver Woodman

Don't update currentTrackBundle until end of block

If currentTrackBundle is updated at the start of the
block and then something goes wrong in the middle (e.g.
one of the skipFully calls) then the extractor wont
resume from the correct place.

This would be caught by our extractor tests if we had
a test sample that requires skipping to the sample data.
I'll try and construct one of those.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131191174
parent 42efb541
...@@ -917,7 +917,7 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -917,7 +917,7 @@ public final class FragmentedMp4Extractor implements Extractor {
private boolean readSample(ExtractorInput input) throws IOException, InterruptedException { private boolean readSample(ExtractorInput input) throws IOException, InterruptedException {
if (parserState == STATE_READING_SAMPLE_START) { if (parserState == STATE_READING_SAMPLE_START) {
if (currentTrackBundle == null) { if (currentTrackBundle == null) {
currentTrackBundle = getNextFragmentRun(trackBundles); TrackBundle currentTrackBundle = getNextFragmentRun(trackBundles);
if (currentTrackBundle == null) { if (currentTrackBundle == null) {
// We've run out of samples in the current mdat. Discard any trailing data and prepare to // We've run out of samples in the current mdat. Discard any trailing data and prepare to
// read the header of the next atom. // read the header of the next atom.
...@@ -938,6 +938,7 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -938,6 +938,7 @@ public final class FragmentedMp4Extractor implements Extractor {
throw new ParserException("Offset to sample data was negative."); throw new ParserException("Offset to sample data was negative.");
} }
input.skipFully(bytesToSkip); input.skipFully(bytesToSkip);
this.currentTrackBundle = currentTrackBundle;
} }
sampleSize = currentTrackBundle.fragment sampleSize = currentTrackBundle.fragment
.sampleSizeTable[currentTrackBundle.currentSampleIndex]; .sampleSizeTable[currentTrackBundle.currentSampleIndex];
......
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