Chromium Code Reviews| 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 5edd967430883a8b6d8eca7df1a0824a762e0f2e..54075050385ebd0241b8ae17460f0191ea44c4c2 100644 |
| --- a/content/renderer/media/webrtc_audio_device_impl.cc |
| +++ b/content/renderer/media/webrtc_audio_device_impl.cc |
| @@ -222,13 +222,13 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
| DCHECK(!capturer_.get()); |
| capturer_ = WebRtcAudioCapturer::CreateCapturer(); |
| + |
| // Add itself as an audio track to the |capturer_|. This is because WebRTC |
| // supports only one ADM but multiple audio tracks, so the ADM can't be the |
| // sink of certain audio track now. |
| // TODO(xians): Register the ADM as the sink of the audio track if WebRTC |
|
henrika (OOO until Aug 14)
2013/06/05 09:09:20
Any existing crbug that you could add this this TO
no longer working on chromium
2013/06/05 16:29:45
Done
|
| // supports one ADM for each audio track. |
| - if (capturer_.get()) |
| - capturer_->AddSink(this); |
| + capturer_->SetDefaultSink(this); |
|
henrika (OOO until Aug 14)
2013/06/05 09:09:20
What happens with the capturer if only non-default
no longer working on chromium
2013/06/05 16:29:45
I am open to another more meaningful name, any sug
|
| // We need to return a success to continue the initialization of WebRtc VoE |
| // because failure on the capturer_ initialization should not prevent WebRTC |
| @@ -261,7 +261,7 @@ int32_t WebRtcAudioDeviceImpl::Terminate() { |
| if (capturer_.get()) { |
| // |capturer_| is stopped by the media stream, so do not need to |
| // call Stop() here. |
| - capturer_->RemoveSink(this); |
| + capturer_->SetDefaultSink(NULL); |
| capturer_ = NULL; |
| } |
| @@ -343,18 +343,27 @@ int32_t WebRtcAudioDeviceImpl::StartRecording() { |
| return -1; |
| } |
| - start_capture_time_ = base::Time::Now(); |
| + { |
| + base::AutoLock auto_lock(lock_); |
| + if (recording_) |
| + return 0; |
| - base::AutoLock auto_lock(lock_); |
| - recording_ = true; |
| + recording_ = true; |
| + } |
| + |
| + start_capture_time_ = base::Time::Now(); |
| return 0; |
| } |
| int32_t WebRtcAudioDeviceImpl::StopRecording() { |
| DVLOG(1) << "WebRtcAudioDeviceImpl::StopRecording()"; |
| - if (!recording_) { |
| - return 0; |
| + { |
| + base::AutoLock auto_lock(lock_); |
| + if (!recording_) |
| + return 0; |
| + |
| + recording_ = false; |
| } |
| // Add histogram data to be uploaded as part of an UMA logging event. |
| @@ -364,9 +373,6 @@ int32_t WebRtcAudioDeviceImpl::StopRecording() { |
| UMA_HISTOGRAM_LONG_TIMES("WebRTC.AudioCaptureTime", capture_time); |
| } |
| - base::AutoLock auto_lock(lock_); |
| - recording_ = false; |
| - |
| return 0; |
| } |