ExoAssetLoaderRenderer:Drop negative timestamp buffers when transmuxing

Prevents queuing unneeded buffers when transmuxing. (we already do this when transcoding).

PiperOrigin-RevId: 576080462
This commit is contained in:
tofunmi 2023-10-24 03:20:04 -07:00 committed by Copybara-Service
parent 64d93eb0d1
commit 771d203204
2 changed files with 5 additions and 3 deletions

View File

@ -174,9 +174,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* *
* <p>The input buffer is cleared if it should be dropped. * <p>The input buffer is cleared if it should be dropped.
*/ */
protected boolean shouldDropInputBuffer(DecoderInputBuffer inputBuffer) { protected abstract boolean shouldDropInputBuffer(DecoderInputBuffer inputBuffer);
return false;
}
/** Called before a {@link DecoderInputBuffer} is queued to the decoder. */ /** Called before a {@link DecoderInputBuffer} is queued to the decoder. */
protected void onDecoderInputReady(DecoderInputBuffer inputBuffer) {} protected void onDecoderInputReady(DecoderInputBuffer inputBuffer) {}

View File

@ -115,6 +115,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
if (decoder == null) { if (decoder == null) {
inputBuffer.timeUs -= streamStartPositionUs; inputBuffer.timeUs -= streamStartPositionUs;
if (inputBuffer.timeUs < 0) {
inputBuffer.clear();
return true;
}
} }
return false; return false;
} }