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

Unified Diff: content/renderer/media/audio_renderer_impl.cc

Issue 8294027: Merge r104540 into 874 (m15). (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: '' Created 9 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 | media/base/composite_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_renderer_impl.cc
===================================================================
--- content/renderer/media/audio_renderer_impl.cc (revision 105911)
+++ content/renderer/media/audio_renderer_impl.cc (working copy)
@@ -96,19 +96,28 @@
}
void AudioRendererImpl::OnStop() {
- base::AutoLock auto_lock(lock_);
- if (stopped_)
- return;
- stopped_ = true;
+ // Since joining with the audio thread can acquire lock_, we make sure to
+ // Join() with it not under lock.
+ base::DelegateSimpleThread* audio_thread = NULL;
+ {
+ base::AutoLock auto_lock(lock_);
+ if (stopped_)
+ return;
+ stopped_ = true;
- ChildProcess::current()->io_message_loop()->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &AudioRendererImpl::DestroyTask));
+ DCHECK_EQ(!audio_thread_.get(), !socket_.get());
+ if (socket_.get())
+ socket_->Close();
+ if (audio_thread_.get())
+ audio_thread = audio_thread_.get();
- if (audio_thread_.get()) {
- socket_->Close();
- audio_thread_->Join();
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &AudioRendererImpl::DestroyTask));
}
+
+ if (audio_thread)
+ audio_thread->Join();
}
void AudioRendererImpl::NotifyDataAvailableIfNecessary() {
« no previous file with comments | « no previous file | media/base/composite_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698