Reland "Remove APM internal usage of EchoCancellation"

Original CL:
https://webrtc-review.googlesource.com/c/src/+/97603
 - 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.

The 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.

Revert CL:
https://webrtc-review.googlesource.com/c/src/+/100305

Bug: webrtc:9535
TBR: gustaf@webrtc.org
Change-Id: I9248046b3a6a82df6221e502481836948643a991
Reviewed-on: https://webrtc-review.googlesource.com/100461
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24749}
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;
     }