 Chromium Code Reviews
 Chromium Code Reviews Issue 187913002:
  Support the Aec dump for the APM in chrome  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master
    
  
    Issue 187913002:
  Support the Aec dump for the APM in chrome  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master| Index: content/renderer/media/webrtc_audio_capturer.cc | 
| diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc | 
| index 8313fcac5f4228ebf10ff50856e2a12ab2f41edb..3e9329d02aec91cc677cc5096f8f3fe9704a4e03 100644 | 
| --- a/content/renderer/media/webrtc_audio_capturer.cc | 
| +++ b/content/renderer/media/webrtc_audio_capturer.cc | 
| @@ -212,7 +212,8 @@ WebRtcAudioCapturer::WebRtcAudioCapturer( | 
| peer_connection_mode_(false), | 
| key_pressed_(false), | 
| need_audio_processing_(false), | 
| - audio_device_(audio_device) { | 
| + audio_device_(audio_device), | 
| + aec_dump_file_(base::kInvalidPlatformFileValue) { | 
| DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()"; | 
| } | 
| @@ -298,6 +299,10 @@ void WebRtcAudioCapturer::SetCapturerSource( | 
| scoped_refptr<MediaStreamAudioProcessor> new_audio_processor( | 
| new MediaStreamAudioProcessor(params, constraints, effects, | 
| audio_device_)); | 
| + // Start the Aec dump on the new audio processor object. | 
| + if (aec_dump_file_ != base::kInvalidPlatformFileValue) | 
| + new_audio_processor->StartAecDump(aec_dump_file_); | 
| + | 
| { | 
| base::AutoLock auto_lock(lock_); | 
| audio_processor_ = new_audio_processor; | 
| @@ -351,6 +356,7 @@ void WebRtcAudioCapturer::EnablePeerConnectionMode() { | 
| } | 
| void WebRtcAudioCapturer::Start() { | 
| + DCHECK(thread_checker_.CalledOnValidThread()); | 
| DVLOG(1) << "WebRtcAudioCapturer::Start()"; | 
| base::AutoLock auto_lock(lock_); | 
| if (running_ || !source_) | 
| @@ -364,6 +370,7 @@ void WebRtcAudioCapturer::Start() { | 
| } | 
| void WebRtcAudioCapturer::Stop() { | 
| + DCHECK(thread_checker_.CalledOnValidThread()); | 
| DVLOG(1) << "WebRtcAudioCapturer::Stop()"; | 
| scoped_refptr<media::AudioCapturerSource> source; | 
| TrackList::ItemList tracks; | 
| @@ -382,6 +389,9 @@ void WebRtcAudioCapturer::Stop() { | 
| if (audio_device_) | 
| audio_device_->RemoveAudioCapturer(this); | 
| + // Stop the Aec dump. | 
| + StopAecDump(); | 
| + | 
| for (TrackList::ItemList::const_iterator it = tracks.begin(); | 
| it != tracks.end(); | 
| ++it) { | 
| @@ -566,4 +576,27 @@ void WebRtcAudioCapturer::SetCapturerSourceForTesting( | 
| constraints_); | 
| } | 
| +void WebRtcAudioCapturer::StartAecDump( | 
| + const base::PlatformFile& aec_dump_file) { | 
| + DCHECK(thread_checker_.CalledOnValidThread()); | 
| + DCHECK_NE(aec_dump_file, base::kInvalidPlatformFileValue); | 
| + DCHECK(aec_dump_file_ == base::kInvalidPlatformFileValue || | 
| + aec_dump_file_ == aec_dump_file); | 
| 
Henrik Grunell
2014/03/06 10:12:20
IS it expected to be called multiple times with th
 
no longer working on chromium
2014/03/06 18:57:21
The code was removed.
 | 
| + // Do nothing if the Aec dump has been started. | 
| + if (aec_dump_file_ != base::kInvalidPlatformFileValue) | 
| + return; | 
| + | 
| + audio_processor_->StartAecDump(aec_dump_file); | 
| + aec_dump_file_ = aec_dump_file; | 
| 
Henrik Grunell
2014/03/06 10:12:20
|audio_processor_| takes ownership of |aec_dump_fi
 
no longer working on chromium
2014/03/06 18:57:21
Done.
 | 
| +} | 
| + | 
| +void WebRtcAudioCapturer::StopAecDump() { | 
| + DCHECK(thread_checker_.CalledOnValidThread()); | 
| + if (aec_dump_file_ == base::kInvalidPlatformFileValue) | 
| + return; | 
| + | 
| + audio_processor_->StopAecDump(); | 
| + aec_dump_file_ = base::kInvalidPlatformFileValue; | 
| +} | 
| + | 
| } // namespace content |