Commit 1315ac08 authored by watk's avatar watk Committed by Commit bot

Remove calls to MediaCodec#stop from AVDA

Previously there were cases where MediaCodec#stop would be called while
the MediaCodec was in a broken state, which results in hitting a CHECK.
In AVDA we don't actually need to call stop() because it's always called
right before deleting the MediaCodec. This replaces those calls with
explicit deletion.

BUG=582275
TEST=Trying to play videos with unsupported profiles; no crashes

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

Cr-Commit-Position: refs/heads/master@{#374754}
parent 4f3d842e
...@@ -764,9 +764,9 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() { ...@@ -764,9 +764,9 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
// When codec is not in error state we can quickly reset (internally calls // 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 // flush()) for JB-MR2 and beyond. Prior to JB-MR2, flush() had several bugs
// (b/8125974, b/8347958) so we must stop() and reconfigure MediaCodec. The // (b/8125974, b/8347958) so we must delete the MediaCodec and create a new
// full reconfigure is much slower and may cause visible freezing if done // one. The full reconfigure is much slower and may cause visible freezing if
// mid-stream. // done mid-stream.
if (state_ == NO_ERROR && if (state_ == NO_ERROR &&
base::android::BuildInfo::GetInstance()->sdk_int() >= 18) { base::android::BuildInfo::GetInstance()->sdk_int() >= 18) {
DVLOG(3) << __FUNCTION__ << " Doing fast MediaCodec reset (flush)."; DVLOG(3) << __FUNCTION__ << " Doing fast MediaCodec reset (flush).";
...@@ -776,9 +776,9 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() { ...@@ -776,9 +776,9 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
strategy_->CodecChanged(media_codec_.get(), output_picture_buffers_); strategy_->CodecChanged(media_codec_.get(), output_picture_buffers_);
} else { } else {
DVLOG(3) << __FUNCTION__ DVLOG(3) << __FUNCTION__
<< " Doing slow MediaCodec reset (stop/re-configure)."; << " Deleting the MediaCodec and creating a new one.";
io_timer_.Stop(); io_timer_.Stop();
media_codec_->Stop(); media_codec_.reset();
// Changing the codec will also notify the strategy to forget about any // Changing the codec will also notify the strategy to forget about any
// output buffers it has currently. // output buffers it has currently.
state_ = NO_ERROR; state_ = NO_ERROR;
...@@ -848,7 +848,7 @@ void AndroidVideoDecodeAccelerator::Destroy() { ...@@ -848,7 +848,7 @@ void AndroidVideoDecodeAccelerator::Destroy() {
weak_this_factory_.InvalidateWeakPtrs(); weak_this_factory_.InvalidateWeakPtrs();
if (media_codec_) { if (media_codec_) {
io_timer_.Stop(); io_timer_.Stop();
media_codec_->Stop(); media_codec_.reset();
} }
delete this; delete this;
} }
......
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