mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
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
This commit is contained in:
parent
42efb5413a
commit
abaa4f1aad
1 changed files with 2 additions and 1 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Reference in a new issue