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

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 2434003002: AudioRendererImpl: Fix data race. (Closed)
Patch Set: Created 4 years, 2 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 66fe2b79609856ac85bd7896754f36f3920aa48c..379c9570b114175ad358f3c31ec1e0f9af0f2759 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -103,10 +103,12 @@ AudioRendererImpl::~AudioRendererImpl() {
void AudioRendererImpl::StartTicking() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
+
+ base::AutoLock auto_lock(lock_);
+
DCHECK(!rendering_);
rendering_ = true;
- base::AutoLock auto_lock(lock_);
// Wait for an eventual call to SetPlaybackRate() to start rendering.
if (playback_rate_ == 0) {
DCHECK(!sink_playing_);
@@ -133,10 +135,12 @@ void AudioRendererImpl::StartRendering_Locked() {
void AudioRendererImpl::StopTicking() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
+
+ base::AutoLock auto_lock(lock_);
+
DCHECK(rendering_);
rendering_ = false;
- base::AutoLock auto_lock(lock_);
// Rendering should have already been stopped with a zero playback rate.
if (playback_rate_ == 0) {
DCHECK(!sink_playing_);
« 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