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

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') | media/filters/ffmpeg_demuxer.cc » ('J')
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 ac6aca0f271b6364f12c111a24386fe27a3274a8..2aaa12f99593476422ae2bd737699c81d4800cdf 100644
--- a/content/renderer/media/audio_renderer_impl.cc
+++ b/content/renderer/media/audio_renderer_impl.cc
@@ -98,18 +98,28 @@ bool AudioRendererImpl::OnInitialize(int bits_per_channel,
}
void AudioRendererImpl::OnStop() {
- base::AutoLock auto_lock(lock_);
- if (stopped_)
- return;
- stopped_ = true;
-
- ChildProcess::current()->io_message_loop()->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &AudioRendererImpl::DestroyTask));
+ // 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::SyncSocket* socket = NULL;
+ {
+ base::AutoLock auto_lock(lock_);
+ if (stopped_)
+ return;
+ stopped_ = true;
+ DCHECK_EQ(!audio_thread_.get(), !socket_.get());
+ if (audio_thread_.get()) {
+ audio_thread = audio_thread_.get();
+ socket = socket_.get();
+ }
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &AudioRendererImpl::DestroyTask));
+ }
- if (audio_thread_.get()) {
- socket_->Close();
- audio_thread_->Join();
+ if (audio_thread) {
+ CHECK(socket->Close());
acolwell GONE FROM CHROMIUM 2011/10/07 15:50:47 Does this need to happen outside of the lock?
Ami GONE FROM CHROMIUM 2011/10/07 16:44:47 Done.
+ audio_thread->Join();
}
}
@@ -455,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') | media/filters/ffmpeg_demuxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698