mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Don't enforce SimpleDecoder skipping for samples before start time
We currently enforce the skipping if the sample has a timestamp less than the start time. While this may be the default desired behavior for most implementations, it prevents an implementation from outputting a sample with such a timestamp. This change updates the logic to pre-fill the shouldBeSkipped flag based on the input timestamp, and only check this flag on the output buffer. None of the implementations in our library change timestamps of samples, so this is equivalent to the previous code. PiperOrigin-RevId: 629708873
This commit is contained in:
parent
5805287620
commit
fb982c2d54
1 changed files with 4 additions and 2 deletions
|
|
@ -262,6 +262,9 @@ public abstract class SimpleDecoder<
|
|||
if (inputBuffer.isFirstSample()) {
|
||||
outputBuffer.addFlag(C.BUFFER_FLAG_FIRST_SAMPLE);
|
||||
}
|
||||
if (!isAtLeastOutputStartTimeUs(inputBuffer.timeUs)) {
|
||||
outputBuffer.shouldBeSkipped = true;
|
||||
}
|
||||
@Nullable E exception;
|
||||
try {
|
||||
exception = decode(inputBuffer, outputBuffer, resetDecoder);
|
||||
|
|
@ -286,8 +289,7 @@ public abstract class SimpleDecoder<
|
|||
synchronized (lock) {
|
||||
if (flushed) {
|
||||
outputBuffer.release();
|
||||
} else if ((!outputBuffer.isEndOfStream() && !isAtLeastOutputStartTimeUs(outputBuffer.timeUs))
|
||||
|| outputBuffer.shouldBeSkipped) {
|
||||
} else if (outputBuffer.shouldBeSkipped) {
|
||||
skippedOutputBufferCount++;
|
||||
outputBuffer.release();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue