Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_processor.cc |
| diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc |
| index 46d742807bd5c20e4b6fba0bb13223cea158244d..b2760f4f9e79eb7ce3877a867610f89efdc29860 100644 |
| --- a/content/renderer/media/media_stream_audio_processor.cc |
| +++ b/content/renderer/media/media_stream_audio_processor.cc |
| @@ -486,6 +486,25 @@ void MediaStreamAudioProcessor::OnDisableAecDump() { |
| StopEchoCancellationDump(audio_processing_.get()); |
| } |
| +void MediaStreamAudioProcessor::OnAec3Enable(bool enable) { |
| + DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| + if (override_aec3_ == enable) |
| + return; |
| + |
| + override_aec3_ = enable; |
| + if (!has_echo_cancellation_) |
|
Henrik Grunell
2017/04/11 10:12:43
|has_echo_cancellation_| is not initialized in the
hlundin-chromium
2017/04/11 12:40:11
Done. It was unconditionally initialized from the
|
| + return; |
| + |
| + auto apm_config = audio_processing_->GetConfig(); |
| + if (apm_config.echo_canceller3.enabled == enable) |
| + return; |
| + |
| + apm_config.echo_canceller3.enabled = enable; |
| + audio_processing_->ApplyConfig(apm_config); |
| + DCHECK(echo_information_); |
| + echo_information_.reset(new EchoInformation()); |
| +} |
| + |
| void MediaStreamAudioProcessor::OnIpcClosing() { |
| DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| aec_dump_message_filter_ = NULL; |
| @@ -596,6 +615,7 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| const bool echo_cancellation = |
| audio_constraints.GetEchoCancellationProperty(); |
| + has_echo_cancellation_ = echo_cancellation; |
| const bool goog_agc = audio_constraints.GetGoogAutoGainControl(); |
| #if defined(OS_ANDROID) |
| @@ -679,8 +699,8 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| // |echo_information_| we simply discard it. |
| echo_information_.reset(new EchoInformation()); |
| - apm_config.echo_canceller3.enabled = |
| - base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3); |
| + apm_config.echo_canceller3.enabled = override_aec3_.value_or( |
| + base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3)); |
| } else { |
| apm_config.echo_canceller3.enabled = false; |
| } |