Fix mdta handling on I/O error

An I/O error could occur while handling the start of an mdta box, in
which case retrying would cause another ContainerAtom to be added. Fix
this by skipping the mdta header before updating container atoms.

PiperOrigin-RevId: 284000715
This commit is contained in:
andrewlewis 2019-12-05 18:19:13 +00:00 committed by Oliver Woodman
parent 32f02107b4
commit bf495de529

View file

@ -304,13 +304,13 @@ public final class Mp4Extractor implements Extractor, SeekMap {
if (shouldParseContainerAtom(atomType)) {
long endPosition = input.getPosition() + atomSize - atomHeaderBytesRead;
if (atomSize != atomHeaderBytesRead && atomType == Atom.TYPE_meta) {
maybeSkipRemainingMetaAtomHeaderBytes(input);
}
containerAtoms.push(new ContainerAtom(atomType, endPosition));
if (atomSize == atomHeaderBytesRead) {
processAtomEnded(endPosition);
} else {
if (atomType == Atom.TYPE_meta) {
maybeSkipRemainingMetaAtomHeaderBytes(input);
}
// Start reading the first child atom.
enterReadingAtomHeaderState();
}