DebugMediaCodecVideoRenderer: expect output format change after flush

The DebugMediaCodecVideoRenderer expects the MediaCodec to return an
output format change after the MediaCodecRenderer detects an input
format change, but the DebugMediaCodecVideoRenderer resets its state
after flushing MediaCodec. This does not cover the following case: an
input format change is detected when queueing sample with timestamp X
and before the respective output buffer is dequeued, the player seeks
back to X. After seeking back to X, the MCR does not trigger an input
format change for X again, and MediaCodec (correctly) returns an output
format change before dequeueing output X.

This commit is changing DebugMediaCodecVideoRenderer to keep expecting
an output format change after a flush, is one a format pending output.
Such an an edge-case is addressed already in MediaCodecRenderer.

PiperOrigin-RevId: 370482506
This commit is contained in:
christosts 2021-04-26 18:02:37 +01:00 committed by Andrew Lewis
parent ed5ec4e8a8
commit 7af95230cb

View file

@ -140,10 +140,11 @@ import java.util.ArrayList;
protected void resetCodecStateForFlush() {
super.resetCodecStateForFlush();
clearTimestamps();
// Check if there is a format change on the input side still pending propagation to the
// output.
inputFormatChanged = !inputFormatChangeTimesUs.isEmpty();
inputFormatChangeTimesUs.clear();
inputFormatChanged = false;
outputMediaFormatChanged = false;
currentMediaFormat = null;
}
@Override