| Index: content/common/gpu/media/android_video_decode_accelerator.cc
|
| diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc
|
| index 0f23cefc87289e7e34c7f238a9af54433d37ca9f..fec56cffc61e3615bf9c43915347ab7e0baf15d2 100644
|
| --- a/content/common/gpu/media/android_video_decode_accelerator.cc
|
| +++ b/content/common/gpu/media/android_video_decode_accelerator.cc
|
| @@ -317,6 +317,7 @@ AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
|
| error_sequence_token_(0),
|
| defer_errors_(false),
|
| deferred_initialization_pending_(false),
|
| + codec_needs_flush_workaround_(false),
|
| weak_this_factory_(this) {}
|
|
|
| AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() {
|
| @@ -1022,6 +1023,9 @@ void AndroidVideoDecodeAccelerator::OnCodecConfigured(
|
| return;
|
| }
|
|
|
| + codec_needs_flush_workaround_ =
|
| + media::MediaCodecUtil::CodecNeedsFlushWorkaround(media_codec_.get());
|
| +
|
| state_ = NO_ERROR;
|
|
|
| ManageTimer(true);
|
| @@ -1057,13 +1061,7 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
|
| // conservative approach and let the errors post.
|
| // TODO(liberato): revisit this once we sort out the error state a bit more.
|
|
|
| - // When codec is not in error state we can quickly reset (internally calls
|
| - // flush()) for JB-MR2 and beyond. Prior to JB-MR2, flush() had several bugs
|
| - // (b/8125974, b/8347958) so we must delete the MediaCodec and create a new
|
| - // one. The full reconfigure is much slower and may cause visible freezing if
|
| - // done mid-stream.
|
| - if (state_ == NO_ERROR &&
|
| - base::android::BuildInfo::GetInstance()->sdk_int() >= 18) {
|
| + if (state_ == NO_ERROR && !codec_needs_flush_workaround_) {
|
| DVLOG(3) << __FUNCTION__ << " Doing fast MediaCodec reset (flush).";
|
| media_codec_->Reset();
|
| // Since we just flushed all the output buffers, make sure that nothing is
|
| @@ -1073,8 +1071,6 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
|
| DVLOG(3) << __FUNCTION__
|
| << " Deleting the MediaCodec and creating a new one.";
|
| g_avda_timer.Pointer()->StopTimer(this);
|
| - // Changing the codec will also notify the strategy to forget about any
|
| - // output buffers it has currently.
|
| state_ = NO_ERROR;
|
| ConfigureMediaCodecAsynchronously();
|
| }
|
|
|