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

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 2837303003: Fix the crash due to AudioRendererImpl::audio_clock_ being null (Closed)
Patch Set: Don't reset audio_clock_ explicitly + remove the DCHECK 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/renderers/audio_renderer_impl.cc
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc
index 25f4ef34d83c294bfddd2ee7543e81672291036f..e1ca2c180019981e552671922c43b00b980ff224 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -337,21 +337,21 @@ void AudioRendererImpl::Initialize(DemuxerStream* stream,
DCHECK(stream);
DCHECK_EQ(stream->type(), DemuxerStream::AUDIO);
DCHECK(!init_cb.is_null());
+
+ base::AutoLock auto_lock(lock_);
DCHECK(state_ == kUninitialized || state_ == kFlushed);
DCHECK(sink_.get());
// If we are re-initializing playback (e.g. switching media tracks), stop the
// sink first.
if (state_ == kFlushed) {
- sink_->Stop();
- audio_clock_.reset();
+ // Release the lock while we are stopping the sink to avoid deadlock if the
+ // sink needs to wait for the current Render to finish.
+ auto* sink = sink_.get();
+ base::AutoUnlock auto_unlock(lock_);
+ sink->Stop();
}
- // Trying to track down AudioClock crash, http://crbug.com/674856.
- // AudioRenderImpl should only be initialized once to avoid destroying
- // AudioClock while the audio thread is still using it.
- CHECK_EQ(audio_clock_.get(), nullptr);
-
state_ = kInitializing;
client_ = client;
« 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