mirror of
https://github.com/androidx/media.git
synced 2025-05-06 23:20:42 +08:00
FakeTrackOutput: Throw if sample size exceeds maxInputSize
This indicates the extractor has output a Format with a specified maxInputSize that's too small. Failing in FakeTrackOutput ensures this doesn't happen during Extractor tests. PiperOrigin-RevId: 285776069
This commit is contained in:
parent
88be178e0f
commit
5e822e160e
@ -93,6 +93,12 @@ public final class FakeTrackOutput implements TrackOutput, Dumper.Dumpable {
|
|||||||
@Override
|
@Override
|
||||||
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
|
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
|
||||||
CryptoData cryptoData) {
|
CryptoData cryptoData) {
|
||||||
|
if (format == null) {
|
||||||
|
throw new IllegalStateException("TrackOutput must receive format before sampleMetadata");
|
||||||
|
}
|
||||||
|
if (format.maxInputSize != Format.NO_VALUE && size > format.maxInputSize) {
|
||||||
|
throw new IllegalStateException("Sample size exceeds Format.maxInputSize");
|
||||||
|
}
|
||||||
sampleTimesUs.add(timeUs);
|
sampleTimesUs.add(timeUs);
|
||||||
sampleFlags.add(flags);
|
sampleFlags.add(flags);
|
||||||
sampleStartOffsets.add(sampleData.length - offset - size);
|
sampleStartOffsets.add(sampleData.length - offset - size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user