| Index: content/renderer/media/audio_renderer_impl.cc
|
| diff --git a/content/renderer/media/audio_renderer_impl.cc b/content/renderer/media/audio_renderer_impl.cc
|
| index 754b7e006424cd87604977b7d0435b3cb68c2ab8..2c131eca0ae53cafd8ace2db696a749fa1daa370 100644
|
| --- a/content/renderer/media/audio_renderer_impl.cc
|
| +++ b/content/renderer/media/audio_renderer_impl.cc
|
| @@ -99,19 +99,28 @@ bool AudioRendererImpl::OnInitialize(int bits_per_channel,
|
| }
|
|
|
| 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,
|
| - base::Bind(&AudioRendererImpl::DestroyTask, this));
|
| + 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,
|
| + base::Bind(&AudioRendererImpl::DestroyTask, this));
|
| }
|
| +
|
| + if (audio_thread)
|
| + audio_thread->Join();
|
| }
|
|
|
| void AudioRendererImpl::NotifyDataAvailableIfNecessary() {
|
| @@ -456,6 +465,7 @@ void AudioRendererImpl::WillDestroyCurrentMessageLoop() {
|
| // Our audio thread runs here. We receive requests for more data and send it
|
| // on this thread.
|
| void AudioRendererImpl::Run() {
|
| + DCHECK_EQ(kLowLatency, latency_type_);
|
| audio_thread_->SetThreadPriority(base::kThreadPriority_RealtimeAudio);
|
|
|
| int bytes;
|
|
|