Fix handling of 'no chunk readers' in AVI

Before this change the chunk readers array was accessed out of bounds in files
for which no chunk readers are created.

PiperOrigin-RevId: 704323919
This commit is contained in:
andrewlewis 2024-12-09 09:58:17 -08:00 committed by Copybara-Service
parent 1f6c795407
commit fc3f096888

View file

@ -419,8 +419,12 @@ public final class AviExtractor implements Extractor {
chunkReader.compactIndex(); chunkReader.compactIndex();
} }
seekMapHasBeenOutput = true; seekMapHasBeenOutput = true;
if (chunkReaders.length == 0) {
extractorOutput.seekMap(new SeekMap.Unseekable(durationUs));
} else {
extractorOutput.seekMap(new AviSeekMap(durationUs)); extractorOutput.seekMap(new AviSeekMap(durationUs));
} }
}
private long peekSeekOffset(ParsableByteArray idx1Body) { private long peekSeekOffset(ParsableByteArray idx1Body) {
// The spec states the offset is based on the start of the movi list type fourcc, but it also // The spec states the offset is based on the start of the movi list type fourcc, but it also