Commit 800e030e authored by qinmin's avatar qinmin Committed by Commit bot

Fix an issue that a browser seek is requested after decoder draining is interrupted.

When decoder is draining, the current access unit is pointing to the config change AU.
If something interrupts the draining, a surface change for example,
CreateMediaCodecBridge() will fail because the current AU is not an i-frame.
This will cause an unnecessary browser seek.
To avoid this, we should call OnDecoderDrained() first to let video decoder know that config change AU is consumed.

The issue is captured by the DecoderDrainInterruptedBySurfaceChange test on nexus 9.
And this change reenables that test, so no additional test is added.

BUG=429889

Review URL: https://codereview.chromium.org/699763002

Cr-Commit-Position: refs/heads/master@{#302640}
parent a9d6912a
......@@ -118,14 +118,9 @@ bool MediaDecoderJob::Decode(
DCHECK(data_received_cb_.is_null());
DCHECK(ui_task_runner_->BelongsToCurrentThread());
if (!media_codec_bridge_ || need_to_reconfig_decoder_job_) {
if (drain_decoder_)
OnDecoderDrained();
need_to_reconfig_decoder_job_ = !CreateMediaCodecBridge();
if (drain_decoder_) {
// Decoder has been recreated, stop draining.
drain_decoder_ = false;
input_eos_encountered_ = false;
output_eos_encountered_ = false;
access_unit_index_[current_demuxer_data_index_]++;
}
skip_eos_enqueue_ = true;
if (need_to_reconfig_decoder_job_)
return false;
......
......@@ -1962,7 +1962,7 @@ TEST_F(MediaSourcePlayerTest, DecoderDrainInterruptedByRelease) {
EXPECT_EQ(3, demuxer_->num_data_requests());
}
TEST_F(MediaSourcePlayerTest, DISABLED_DecoderDrainInterruptedBySurfaceChange) {
TEST_F(MediaSourcePlayerTest, DecoderDrainInterruptedBySurfaceChange) {
SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
// Test if a video decoder is being drained while surface changes, draining
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment