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

Side by Side Diff: content/renderer/media/webrtc_local_audio_renderer.cc

Issue 12769010: Avoids deadlock in WebRtcLocalAudioRenderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc_local_audio_renderer.h" 5 #include "content/renderer/media/webrtc_local_audio_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 source_->Start(); 170 source_->Start();
171 sink_->Start(); 171 sink_->Start();
172 172
173 last_render_time_ = base::Time::Now(); 173 last_render_time_ = base::Time::Now();
174 playing_ = false; 174 playing_ = false;
175 } 175 }
176 176
177 void WebRtcLocalAudioRenderer::Stop() { 177 void WebRtcLocalAudioRenderer::Stop() {
178 DVLOG(1) << "WebRtcLocalAudioRenderer::Stop()"; 178 DVLOG(1) << "WebRtcLocalAudioRenderer::Stop()";
179 DCHECK(thread_checker_.CalledOnValidThread()); 179 DCHECK(thread_checker_.CalledOnValidThread());
180 base::AutoLock auto_lock(thread_lock_);
181 180
182 if (!sink_) 181 if (!sink_)
183 return; 182 return;
184 183
184 {
185 base::AutoLock auto_lock(thread_lock_);
186 playing_ = false;
187
188 if (loopback_fifo_.get() != NULL) {
189 loopback_fifo_->Clear();
190 loopback_fifo_.reset();
191 }
192 }
193
185 // Stop the output audio stream, i.e, stop asking for data to render. 194 // Stop the output audio stream, i.e, stop asking for data to render.
186 sink_->Stop(); 195 sink_->Stop();
187 sink_ = NULL; 196 sink_ = NULL;
188 197
189 if (loopback_fifo_.get() != NULL) {
190 loopback_fifo_->Clear();
191 loopback_fifo_.reset();
192 }
193
194 // Ensure that the capturer stops feeding us with captured audio. 198 // Ensure that the capturer stops feeding us with captured audio.
195 // Note that, we do not stop the capturer here since it may still be used by 199 // Note that, we do not stop the capturer here since it may still be used by
196 // the WebRTC ADM. 200 // the WebRTC ADM.
197 source_->RemoveCapturerSink(this); 201 source_->RemoveCapturerSink(this);
198 source_ = NULL; 202 source_ = NULL;
199 203
200 if (audio_track_) { 204 if (audio_track_) {
201 audio_track_->UnregisterObserver(this); 205 audio_track_->UnregisterObserver(this);
202 audio_track_ = NULL; 206 audio_track_ = NULL;
203 } 207 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (!sink_) 252 if (!sink_)
249 return base::TimeDelta(); 253 return base::TimeDelta();
250 return total_render_time(); 254 return total_render_time();
251 } 255 }
252 256
253 bool WebRtcLocalAudioRenderer::IsLocalRenderer() const { 257 bool WebRtcLocalAudioRenderer::IsLocalRenderer() const {
254 return true; 258 return true;
255 } 259 }
256 260
257 } // namespace content 261 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698