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

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

Issue 8184003: Fix hangs & crashes in teardown-during-Seek. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
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;
« 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