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

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

Issue 131213003: Fixed the racing in the resampler of webrtc when two streams are calling OnData() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 1daf048fe86c2a8d45c8dcf5b4285672278b68c4..7e27905c3be18845bf8d4028ab6637f991ca43b2 100644
--- a/content/renderer/media/webrtc_audio_device_impl.cc
+++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -81,6 +81,15 @@ int WebRtcAudioDeviceImpl::OnData(const int16* audio_data,
CHECK_EQ(number_of_frames % samples_per_10_msec, 0);
int accumulated_audio_samples = 0;
uint32_t new_volume = 0;
+
+ // The lock here is to protect the racing in the resampler inside webrtc when
+ // there are more than one input streams calling OnData(), which can happen
henrika (OOO until Aug 14) 2014/01/09 10:07:14 nit, ...input stream calling...
no longer working on chromium 2014/01/09 10:18:32 Done.
+ // when the users setup two getUserMedia, one for the microphone, another
+ // for WebAudio. Currently we don't have a better way to fix it except for
+ // adding a lock here to sequence the call.
+ // TODO(xians): Remove this workaround after we move the
henrika (OOO until Aug 14) 2014/01/09 10:07:14 Add link to crbug issue here.
no longer working on chromium 2014/01/09 10:18:32 Done.
+ // webrtc::AudioProcessing module to Chrome.
+ base::AutoLock auto_lock(capture_callback_lock_);
while (accumulated_audio_samples < number_of_frames) {
// Deliver 10ms of recorded 16-bit linear PCM audio.
int new_mic_level = audio_transport_callback_->OnDataAvailable(

Powered by Google App Engine
This is Rietveld 408576698