Separate AEC3 config from AudioProcessing::Config.

The struct containing the config for AEC3 is removed from
AudioProcessing::Config and is put in a new struct called
EchoCanceller3Config.

AEC3 should no longer be activated through
AudioProcessing::ApplyConfig. Instead an EchoCanceller3Factory
can be injected at AudioProcessing creation.

Bug: webrtc:8346
Change-Id: I27e3592e675eec3632a60c45d9e0d12514c2c567
Reviewed-on: https://webrtc-review.googlesource.com/11420
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20342}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index 3db71c1..5e53853 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -603,7 +603,7 @@
       StreamConfig(capture_processing_rate);
 
   int render_processing_rate;
-  if (!config_.echo_canceller3.enabled) {
+  if (!capture_nonlocked_.echo_controller_enabled) {
     render_processing_rate = FindNativeProcessRateToUse(
         std::min(formats_.api_format.reverse_input_stream().sample_rate_hz(),
                  formats_.api_format.reverse_output_stream().sample_rate_hz()),
@@ -616,7 +616,7 @@
   // TODO(aluebs): Remove this restriction once we figure out why the 3-band
   // splitting filter degrades the AEC performance.
   if (render_processing_rate > kSampleRate32kHz &&
-      !config_.echo_canceller3.enabled) {
+      !capture_nonlocked_.echo_controller_enabled) {
     render_processing_rate = submodule_states_.RenderMultiBandProcessingActive()
                                  ? kSampleRate32kHz
                                  : kSampleRate16kHz;
@@ -692,12 +692,13 @@
   LOG(LS_INFO) << "Highpass filter activated: "
                << config_.high_pass_filter.enabled;
 
-  // Inject EchoCanceller3 if requested.
+  // Deprecated way of activating AEC3.
+  // TODO(gustaf): Remove when possible.
   if (config.echo_canceller3.enabled && !echo_control_factory_) {
     capture_nonlocked_.echo_controller_enabled =
         config_.echo_canceller3.enabled;
-    echo_control_factory_ = std::unique_ptr<EchoControlFactory>(
-        new EchoCanceller3Factory(config.echo_canceller3));
+    echo_control_factory_ =
+        std::unique_ptr<EchoControlFactory>(new EchoCanceller3Factory());
     InitializeEchoController();
     LOG(LS_INFO) << "Echo canceller 3 activated: "
                  << capture_nonlocked_.echo_controller_enabled;