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..484cd3f2270c0e443970d713362ea6de82d43f9d 100644 |
--- a/content/renderer/media/media_stream_audio_processor.cc |
+++ b/content/renderer/media/media_stream_audio_processor.cc |
@@ -486,6 +486,23 @@ void MediaStreamAudioProcessor::OnDisableAecDump() { |
StopEchoCancellationDump(audio_processing_.get()); |
} |
+void MediaStreamAudioProcessor::OnAec3Enable(bool enable) { |
+ DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
+ if (override_aec3_ != base::Optional<bool>(enable)) { |
Henrik Grunell
2017/04/10 08:13:28
Early returns instead in this function, e.g.
if (
hlundin-chromium
2017/04/10 10:10:16
Done.
|
+ override_aec3_ = base::Optional<bool>(enable); |
+ if (has_echo_cancellation_) { |
+ DCHECK(audio_processing_); |
Henrik Grunell
2017/04/10 08:13:28
Remove (redundant). It will crash on the next line
hlundin-chromium
2017/04/10 10:10:16
Done.
|
+ auto apm_config = audio_processing_->GetConfig(); |
+ if (apm_config.echo_canceller3.enabled != enable) { |
+ apm_config.echo_canceller3.enabled = enable; |
Henrik Grunell
2017/04/10 08:13:28
I'm not sure how this is supposed to work. If not
hlundin-chromium
2017/04/10 10:10:16
If not overridden, it will already be at the value
Henrik Grunell
2017/04/10 12:33:47
I realized that it can never be un-overridden. Set
|
+ 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 +613,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) |
@@ -680,7 +698,9 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
echo_information_.reset(new EchoInformation()); |
apm_config.echo_canceller3.enabled = |
- base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3); |
+ override_aec3_ |
+ ? *override_aec3_ |
+ : base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3); |
} else { |
apm_config.echo_canceller3.enabled = false; |
} |