Revert "Remove APM internal usage of EchoCancellation"
This reverts commit 1a03960e632a04e2ff866f2048cc36146af83e41.
Reason for revert: breaks downstream projects.
Original change's description:
> 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}
TBR=gustaf@webrtc.org,saza@webrtc.org
Change-Id: Ifdc4235f9c5ee8a8a5d32cc8e1dda0853b941693
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9535
Reviewed-on: https://webrtc-review.googlesource.com/100305
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24729}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index d5bb046..b2eb998 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -672,17 +672,13 @@
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
- public_submodules_->echo_cancellation->Enable(
- config_.echo_canceller.enabled && !config_.echo_canceller.mobile_mode);
+ static_cast<EchoCancellation*>(public_submodules_->echo_cancellation.get())
+ ->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: "
@@ -1310,8 +1306,7 @@
capture_buffer->num_frames_per_band(), capture_nonlocked_.split_rate);
}
RETURN_ON_ERR(public_submodules_->gain_control->ProcessCaptureAudio(
- capture_buffer,
- public_submodules_->echo_cancellation->stream_has_echo()));
+ capture_buffer, echo_cancellation()->stream_has_echo()));
if (submodule_states_.CaptureMultiBandProcessingActive() &&
SampleRateSupportsMultiBand(
@@ -1857,15 +1852,15 @@
void AudioProcessingImpl::MaybeUpdateHistograms() {
static const int kMinDiffDelayMs = 60;
- if (public_submodules_->echo_cancellation->is_enabled()) {
+ if (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 &&
- public_submodules_->echo_cancellation->stream_has_echo()) {
+ echo_cancellation()->stream_has_echo()) {
capture_.stream_delay_jumps = 0;
}
if (capture_.aec_system_delay_jumps == -1 &&
- public_submodules_->echo_cancellation->stream_has_echo()) {
+ echo_cancellation()->stream_has_echo()) {
capture_.aec_system_delay_jumps = 0;
}