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

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

Issue 310013002: Fix the race when the WebRtcAudioDeviceImpl goes away before capturers stop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the indentation. Created 6 years, 7 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_device_impl.cc
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc
index ae37d2074b2f1159605f9cf97197f40f976b5e6b..86b330657d2de4902bc5a3a3d9a0cca6255b492b 100644
--- a/content/renderer/media/webrtc_audio_device_impl.cc
+++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -248,7 +248,16 @@ int32_t WebRtcAudioDeviceImpl::Terminate() {
DisableAecDump();
- capturers_.clear();
+ // Stop all the capturers to ensure no further OnData() and
+ // RemoveAudioCapturer() callback.
+ // Cache the captures in a local list since WebRtcAudioCapturer::Stop()
henrika (OOO until Aug 14) 2014/06/03 11:00:15 capturers
no longer working on chromium 2014/06/03 11:31:14 Done.
+ // will trigger RemoveAudioCapturer() callback.
+ CapturerList capturers;
+ capturers.swap(capturers_);
+ for (CapturerList::const_iterator iter = capturers.begin();
+ iter != capturers.end(); ++iter) {
+ (*iter)->Stop();
+ }
initialized_ = false;
return 0;

Powered by Google App Engine
This is Rietveld 408576698