Remove APM internal usage of EchoCancellation
This CL:
- Changes EchoCancellationImpl to inherit privately from
EchoCancellation.
- Removes usage of AudioProcessing::echo_cancellation() inside most of
the audio processing module and unit tests.
- Default-enables metrics collection in AEC2.
This CL breaks audioproc_f backwards compatibility: It can no longer
use all recorded settings (drift compensation, suppression level), but
prints an error message when such settings are encountered.
Some code in audio_processing_unittest.cc still uses the old interface.
I'll handle that in a separate change, as it is not as straightforward
to preserve coverage.
Bug: webrtc:9535
Change-Id: Ia4d4b8d117ccbe516e5345c15d37298418590686
Reviewed-on: https://webrtc-review.googlesource.com/97603
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24724}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index b2eb998..d5bb046 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -672,13 +672,17 @@
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
- static_cast<EchoCancellation*>(public_submodules_->echo_cancellation.get())
- ->Enable(config_.echo_canceller.enabled &&
- !config_.echo_canceller.mobile_mode);
+ public_submodules_->echo_cancellation->Enable(
+ config_.echo_canceller.enabled && !config_.echo_canceller.mobile_mode);
static_cast<EchoControlMobile*>(public_submodules_->echo_control_mobile.get())
->Enable(config_.echo_canceller.enabled &&
config_.echo_canceller.mobile_mode);
+ public_submodules_->echo_cancellation->set_suppression_level(
+ config.echo_canceller.legacy_moderate_suppression_level
+ ? EchoCancellation::SuppressionLevel::kModerateSuppression
+ : EchoCancellation::SuppressionLevel::kHighSuppression);
+
InitializeLowCutFilter();
RTC_LOG(LS_INFO) << "Highpass filter activated: "
@@ -1306,7 +1310,8 @@
capture_buffer->num_frames_per_band(), capture_nonlocked_.split_rate);
}
RETURN_ON_ERR(public_submodules_->gain_control->ProcessCaptureAudio(
- capture_buffer, echo_cancellation()->stream_has_echo()));
+ capture_buffer,
+ public_submodules_->echo_cancellation->stream_has_echo()));
if (submodule_states_.CaptureMultiBandProcessingActive() &&
SampleRateSupportsMultiBand(
@@ -1852,15 +1857,15 @@
void AudioProcessingImpl::MaybeUpdateHistograms() {
static const int kMinDiffDelayMs = 60;
- if (echo_cancellation()->is_enabled()) {
+ if (public_submodules_->echo_cancellation->is_enabled()) {
// Activate delay_jumps_ counters if we know echo_cancellation is running.
// If a stream has echo we know that the echo_cancellation is in process.
if (capture_.stream_delay_jumps == -1 &&
- echo_cancellation()->stream_has_echo()) {
+ public_submodules_->echo_cancellation->stream_has_echo()) {
capture_.stream_delay_jumps = 0;
}
if (capture_.aec_system_delay_jumps == -1 &&
- echo_cancellation()->stream_has_echo()) {
+ public_submodules_->echo_cancellation->stream_has_echo()) {
capture_.aec_system_delay_jumps = 0;
}