AEC3: Ensure that the high-pass filter is on whenever the AEC is active
This CL ensures that the high-pass filter is on whenever the echo
controller is on. This is important as the echo controller code assumes
that the external high-pass filter is active.
The CL also corrects the ToggleAec unit test (which started failing
after this code change).
Bug: webrtc:11159, chromium:1030179
Change-Id: Ief86eda8f7c67df1c25ac1a06d2cc0778e01196d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161228
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29998}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index 3e49c0c..97a8379 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -1808,7 +1808,12 @@
}
void AudioProcessingImpl::InitializeHighPassFilter() {
- if (submodule_states_.HighPassFilteringRequired()) {
+ bool high_pass_filter_needed_by_aec =
+ config_.echo_canceller.enabled &&
+ config_.echo_canceller.enforce_high_pass_filtering &&
+ !config_.echo_canceller.mobile_mode;
+ if (submodule_states_.HighPassFilteringRequired() ||
+ high_pass_filter_needed_by_aec) {
submodules_.high_pass_filter.reset(new HighPassFilter(num_proc_channels()));
} else {
submodules_.high_pass_filter.reset();
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 8b0dce9..2ec3367 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -283,6 +283,8 @@
// Recommended not to use. Will be removed in the future.
bool use_legacy_aec = false;
bool export_linear_aec_output = false;
+ // Enforce the highpass filter to be on (has no effect for the mobile
+ // mode).
bool enforce_high_pass_filtering = true;
} echo_canceller;
diff --git a/modules/audio_processing/test/debug_dump_test.cc b/modules/audio_processing/test/debug_dump_test.cc
index b769a66..9561091 100644
--- a/modules/audio_processing/test/debug_dump_test.cc
+++ b/modules/audio_processing/test/debug_dump_test.cc
@@ -346,7 +346,7 @@
generator.StartRecording();
generator.Process(100);
- apm_config.echo_canceller.enabled = true;
+ apm_config.echo_canceller.enabled = false;
generator.apm()->ApplyConfig(apm_config);
generator.Process(100);