Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: media/gpu/android_video_decode_accelerator.cc

Issue 2864683002: Don't ReleaseCodecAndBundle in AVDA::ActualDestroy. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator.cc
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android_video_decode_accelerator.cc
index d1416a11c527ac2e369c48dcd666136bc0308422..6ae1d349bcdae22ef70e6937ba594b185acefadc 100644
--- a/media/gpu/android_video_decode_accelerator.cc
+++ b/media/gpu/android_video_decode_accelerator.cc
@@ -1302,7 +1302,10 @@ void AndroidVideoDecodeAccelerator::ActualDestroy() {
// our weak refs.
weak_this_factory_.InvalidateWeakPtrs();
GetManager()->StopTimer(this);
- ReleaseCodecAndBundle();
+ // We only release the codec here, in case codec allocation is in progress.
+ // We don't want to modify |codec_config_|. Note that the ref will sill be
+ // dropped when it completes, or when we delete |this|.
+ ReleaseCodec();
delete this;
}
@@ -1394,7 +1397,8 @@ void AndroidVideoDecodeAccelerator::OnStopUsingOverlayImmediately(
// If we're currently asynchronously configuring a codec, it will be destroyed
// when configuration completes and it notices that |state_| has changed to
- // SURFACE_DESTROYED.
+ // SURFACE_DESTROYED. It's safe to modify |codec_config_| here, since we
+ // checked above for WAITING_FOR_CODEC.
state_ = SURFACE_DESTROYED;
ReleaseCodecAndBundle();
@@ -1656,6 +1660,7 @@ bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden()
bool AndroidVideoDecodeAccelerator::UpdateSurface() {
DCHECK(incoming_overlay_);
+ DCHECK_NE(state_, WAITING_FOR_CODEC);
// Start surface creation. Note that if we're called via surfaceDestroyed,
// then this must complete synchronously or it will DCHECK. Otherwise, we
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698