From abaa4f1aad4db31ada9bf8d98dcf41073af3344a Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 24 Aug 2016 10:51:48 -0700 Subject: [PATCH] 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 --- .../exoplayer2/extractor/mp4/FragmentedMp4Extractor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java b/library/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java index 152785e654..8487584eb8 100644 --- a/library/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java +++ b/library/src/main/java/com/google/android/exoplayer2/extractor/mp4/FragmentedMp4Extractor.java @@ -917,7 +917,7 @@ public final class FragmentedMp4Extractor implements Extractor { private boolean readSample(ExtractorInput input) throws IOException, InterruptedException { if (parserState == STATE_READING_SAMPLE_START) { if (currentTrackBundle == null) { - currentTrackBundle = getNextFragmentRun(trackBundles); + TrackBundle currentTrackBundle = getNextFragmentRun(trackBundles); if (currentTrackBundle == null) { // We've run out of samples in the current mdat. Discard any trailing data and prepare to // read the header of the next atom. @@ -938,6 +938,7 @@ public final class FragmentedMp4Extractor implements Extractor { throw new ParserException("Offset to sample data was negative."); } input.skipFully(bytesToSkip); + this.currentTrackBundle = currentTrackBundle; } sampleSize = currentTrackBundle.fragment .sampleSizeTable[currentTrackBundle.currentSampleIndex];