Fix empty container box bug for fMP4 extractor
This fix derives from issue #1308, which came up in unfragmented mp4 files. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117236416
This commit is contained in:
parent
eeddd6d8df
commit
6fc8057146
@ -243,7 +243,12 @@ public final class FragmentedMp4Extractor implements Extractor {
|
|||||||
if (shouldParseContainerAtom(atomType)) {
|
if (shouldParseContainerAtom(atomType)) {
|
||||||
long endPosition = input.getPosition() + atomSize - Atom.HEADER_SIZE;
|
long endPosition = input.getPosition() + atomSize - Atom.HEADER_SIZE;
|
||||||
containerAtoms.add(new ContainerAtom(atomType, endPosition));
|
containerAtoms.add(new ContainerAtom(atomType, endPosition));
|
||||||
|
if (atomSize == atomHeaderBytesRead) {
|
||||||
|
processAtomEnded(endPosition);
|
||||||
|
} else {
|
||||||
|
// Start reading the first child atom.
|
||||||
enterReadingAtomHeaderState();
|
enterReadingAtomHeaderState();
|
||||||
|
}
|
||||||
} else if (shouldParseLeafAtom(atomType)) {
|
} else if (shouldParseLeafAtom(atomType)) {
|
||||||
if (atomHeaderBytesRead != Atom.HEADER_SIZE) {
|
if (atomHeaderBytesRead != Atom.HEADER_SIZE) {
|
||||||
throw new ParserException("Leaf atom defines extended atom size (unsupported).");
|
throw new ParserException("Leaf atom defines extended atom size (unsupported).");
|
||||||
@ -273,8 +278,11 @@ public final class FragmentedMp4Extractor implements Extractor {
|
|||||||
} else {
|
} else {
|
||||||
input.skipFully(atomPayloadSize);
|
input.skipFully(atomPayloadSize);
|
||||||
}
|
}
|
||||||
long currentPosition = input.getPosition();
|
processAtomEnded(input.getPosition());
|
||||||
while (!containerAtoms.isEmpty() && containerAtoms.peek().endPosition == currentPosition) {
|
}
|
||||||
|
|
||||||
|
private void processAtomEnded(long atomEndPosition) throws ParserException {
|
||||||
|
while (!containerAtoms.isEmpty() && containerAtoms.peek().endPosition == atomEndPosition) {
|
||||||
onContainerAtomRead(containerAtoms.pop());
|
onContainerAtomRead(containerAtoms.pop());
|
||||||
}
|
}
|
||||||
enterReadingAtomHeaderState();
|
enterReadingAtomHeaderState();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user