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

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

Issue 178153007: Avoid hitting the thread check when WebRtcAudioRenderer is going away. (Closed) Base URL: http://git.chromium.org/chromium/src.git@libjingle_get_stats
Patch Set: Created 6 years, 10 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
Index: content/renderer/media/webrtc_audio_renderer.cc
diff --git a/content/renderer/media/webrtc_audio_renderer.cc b/content/renderer/media/webrtc_audio_renderer.cc
index edc014a1cbb09d72a2ba1bef7d1fd662ad4dc499..581faaa0a2df99dff77a3e7c2e0b1b55345da983 100644
--- a/content/renderer/media/webrtc_audio_renderer.cc
+++ b/content/renderer/media/webrtc_audio_renderer.cc
@@ -422,6 +422,13 @@ void WebRtcAudioRenderer::EnterPauseState() {
void WebRtcAudioRenderer::Stop() {
DVLOG(1) << "WebRtcAudioRenderer::Stop()";
DCHECK(thread_checker_.CalledOnValidThread());
+ // Make sure to stop the sink while _not_ holding the lock since the Render()
+ // callback may currently be executing and try to grab the lock while we're
+ // stopping the thread on which it runs.
+ // Stop the sink before calling RemoveAudioRenderer() on the source to make
+ // sure that no more callback will get into the source.
tommi (sloooow) - chröme 2014/03/04 20:48:39 nit: // Stop the sink before calling RemoveAudioRe
no longer working on chromium 2014/03/05 13:01:04 Done.
+ sink_->Stop();
+
{
base::AutoLock auto_lock(lock_);
if (state_ == UNINITIALIZED)
@@ -436,11 +443,6 @@ void WebRtcAudioRenderer::Stop() {
source_ = NULL;
state_ = UNINITIALIZED;
}
-
- // Make sure to stop the sink while _not_ holding the lock since the Render()
- // callback may currently be executing and try to grab the lock while we're
- // stopping the thread on which it runs.
- sink_->Stop();
}
void WebRtcAudioRenderer::SetVolume(float volume) {

Powered by Google App Engine
This is Rietveld 408576698