mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00: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
4eb06373b1
commit
2fe3e188a9
1 changed files with 6 additions and 0 deletions
|
|
@ -93,6 +93,12 @@ public final class FakeTrackOutput implements TrackOutput, Dumper.Dumpable {
|
|||
@Override
|
||||
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
|
||||
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);
|
||||
sampleFlags.add(flags);
|
||||
sampleStartOffsets.add(sampleData.length - offset - size);
|
||||
|
|
|
|||
Loading…
Reference in a new issue