Fix saiz and senc sample count checks for FMP4
Issue: #7592 PiperOrigin-RevId: 320556981
This commit is contained in:
parent
fd3e10ed76
commit
c29fc94540
@ -809,8 +809,12 @@ public class FragmentedMp4Extractor implements Extractor {
|
||||
int defaultSampleInfoSize = saiz.readUnsignedByte();
|
||||
|
||||
int sampleCount = saiz.readUnsignedIntToInt();
|
||||
if (sampleCount != out.sampleCount) {
|
||||
throw new ParserException("Length mismatch: " + sampleCount + ", " + out.sampleCount);
|
||||
if (sampleCount > out.sampleCount) {
|
||||
throw new ParserException(
|
||||
"Saiz sample count "
|
||||
+ sampleCount
|
||||
+ " is greater than fragment sample count"
|
||||
+ out.sampleCount);
|
||||
}
|
||||
|
||||
int totalSize = 0;
|
||||
@ -826,8 +830,11 @@ public class FragmentedMp4Extractor implements Extractor {
|
||||
totalSize += defaultSampleInfoSize * sampleCount;
|
||||
Arrays.fill(out.sampleHasSubsampleEncryptionTable, 0, sampleCount, subsampleEncryption);
|
||||
}
|
||||
Arrays.fill(out.sampleHasSubsampleEncryptionTable, sampleCount, out.sampleCount, false);
|
||||
if (totalSize > 0) {
|
||||
out.initEncryptionData(totalSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a saio atom (defined in 14496-12).
|
||||
@ -1068,8 +1075,16 @@ public class FragmentedMp4Extractor implements Extractor {
|
||||
|
||||
boolean subsampleEncryption = (flags & 0x02 /* use_subsample_encryption */) != 0;
|
||||
int sampleCount = senc.readUnsignedIntToInt();
|
||||
if (sampleCount != out.sampleCount) {
|
||||
throw new ParserException("Length mismatch: " + sampleCount + ", " + out.sampleCount);
|
||||
if (sampleCount == 0) {
|
||||
// Samples are unencrypted.
|
||||
Arrays.fill(out.sampleHasSubsampleEncryptionTable, 0, out.sampleCount, false);
|
||||
return;
|
||||
} else if (sampleCount != out.sampleCount) {
|
||||
throw new ParserException(
|
||||
"Senc sample count "
|
||||
+ sampleCount
|
||||
+ " is different from fragment sample count"
|
||||
+ out.sampleCount);
|
||||
}
|
||||
|
||||
Arrays.fill(out.sampleHasSubsampleEncryptionTable, 0, sampleCount, subsampleEncryption);
|
||||
|
Loading…
x
Reference in New Issue
Block a user