Make AEC3 the default desktop AEC option in WebRTC

Bug: webrtc:10366
Change-Id: I854ed62df1da489fdab43e9157dff79b7287cacb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125081
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26983}
diff --git a/modules/audio_processing/test/debug_dump_test.cc b/modules/audio_processing/test/debug_dump_test.cc
index 0f3ebff..be0af9b 100644
--- a/modules/audio_processing/test/debug_dump_test.cc
+++ b/modules/audio_processing/test/debug_dump_test.cc
@@ -48,15 +48,10 @@
                      int reverse_channels,
                      const Config& config,
                      const std::string& dump_file_name,
-                     bool enable_aec3,
                      bool enable_pre_amplifier);
 
   // Constructor that uses default input files.
   explicit DebugDumpGenerator(const Config& config,
-                              const AudioProcessing::Config& apm_config,
-                              bool enable_aec3);
-
-  explicit DebugDumpGenerator(const Config& config,
                               const AudioProcessing::Config& apm_config);
 
   ~DebugDumpGenerator();
@@ -129,7 +124,6 @@
                                        int reverse_channels,
                                        const Config& config,
                                        const std::string& dump_file_name,
-                                       bool enable_aec3,
                                        bool enable_pre_amplifier)
     : input_config_(input_rate_hz, input_channels),
       reverse_config_(reverse_rate_hz, reverse_channels),
@@ -148,17 +142,12 @@
       worker_queue_("debug_dump_generator_worker_queue"),
       dump_file_name_(dump_file_name) {
   AudioProcessingBuilder apm_builder;
-  if (enable_aec3) {
-    apm_builder.SetEchoControlFactory(
-        std::unique_ptr<EchoControlFactory>(new EchoCanceller3Factory()));
-  }
   apm_.reset(apm_builder.Create(config));
 }
 
 DebugDumpGenerator::DebugDumpGenerator(
     const Config& config,
-    const AudioProcessing::Config& apm_config,
-    bool enable_aec3)
+    const AudioProcessing::Config& apm_config)
     : DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"),
                          32000,
                          2,
@@ -167,18 +156,10 @@
                          2,
                          config,
                          TempFilename(OutputPath(), "debug_aec"),
-                         enable_aec3,
                          apm_config.pre_amplifier.enabled) {
   apm_->ApplyConfig(apm_config);
 }
 
-DebugDumpGenerator::DebugDumpGenerator(
-    const Config& config,
-    const AudioProcessing::Config& apm_config)
-    : DebugDumpGenerator(config, apm_config, false) {
-  apm_->ApplyConfig(apm_config);
-}
-
 DebugDumpGenerator::~DebugDumpGenerator() {
   remove(dump_file_name_.c_str());
 }
@@ -360,22 +341,7 @@
 TEST_F(DebugDumpTest, ToggleAec) {
   Config config;
   AudioProcessing::Config apm_config;
-  DebugDumpGenerator generator(config, apm_config);
-  generator.StartRecording();
-  generator.Process(100);
-
   apm_config.echo_canceller.enabled = true;
-  generator.apm()->ApplyConfig(apm_config);
-
-  generator.Process(100);
-  generator.StopRecording();
-  VerifyDebugDump(generator.dump_file_name());
-}
-
-TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) {
-  Config config;
-  config.Set<DelayAgnostic>(new DelayAgnostic(true));
-  AudioProcessing::Config apm_config;
   DebugDumpGenerator generator(config, apm_config);
   generator.StartRecording();
   generator.Process(100);
@@ -390,8 +356,11 @@
 
 TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) {
   Config config;
+  AudioProcessing::Config apm_config;
+  apm_config.echo_canceller.enabled = true;
+  apm_config.echo_canceller.use_legacy_aec = true;
   config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
-  DebugDumpGenerator generator(config, AudioProcessing::Config());
+  DebugDumpGenerator generator(config, apm_config);
   generator.StartRecording();
   generator.Process(100);
   generator.StopRecording();
@@ -408,6 +377,8 @@
       ASSERT_TRUE(msg->has_experiments_description());
       EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
                           msg->experiments_description().c_str());
+      EXPECT_PRED_FORMAT2(testing::IsSubstring, "Legacy AEC",
+                          msg->experiments_description().c_str());
     }
   }
 }
@@ -416,11 +387,9 @@
   Config config;
   AudioProcessing::Config apm_config;
   apm_config.echo_canceller.enabled = true;
-  config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
   // Arbitrarily set clipping gain to 17, which will never be the default.
   config.Set<ExperimentalAgc>(new ExperimentalAgc(true, 0, 17));
-  bool enable_aec3 = true;
-  DebugDumpGenerator generator(config, apm_config, enable_aec3);
+  DebugDumpGenerator generator(config, apm_config);
   generator.StartRecording();
   generator.Process(100);
   generator.StopRecording();
@@ -435,10 +404,10 @@
     if (event->type() == audioproc::Event::CONFIG) {
       const audioproc::Config* msg = &event->config();
       ASSERT_TRUE(msg->has_experiments_description());
-      EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
-                          msg->experiments_description().c_str());
       EXPECT_PRED_FORMAT2(testing::IsSubstring, "EchoController",
                           msg->experiments_description().c_str());
+      EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "Legacy AEC",
+                          msg->experiments_description().c_str());
       EXPECT_PRED_FORMAT2(testing::IsSubstring, "AgcClippingLevelExperiment",
                           msg->experiments_description().c_str());
     }
@@ -447,8 +416,10 @@
 
 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
   Config config;
-  config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
-  DebugDumpGenerator generator(config, AudioProcessing::Config());
+  AudioProcessing::Config apm_config;
+  apm_config.echo_canceller.enabled = true;
+  apm_config.echo_canceller.use_legacy_aec = true;
+  DebugDumpGenerator generator(config, apm_config);
   generator.StartRecording();
   generator.Process(100);
   generator.StopRecording();
@@ -463,9 +434,7 @@
     if (event->type() == audioproc::Event::CONFIG) {
       const audioproc::Config* msg = &event->config();
       ASSERT_TRUE(msg->has_experiments_description());
-      EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
-                          msg->experiments_description().c_str());
-      EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AEC3",
+      EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "EchoController",
                           msg->experiments_description().c_str());
       EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AgcClippingLevelExperiment",
                           msg->experiments_description().c_str());
@@ -477,7 +446,7 @@
   Config config;
   AudioProcessing::Config apm_config;
   apm_config.echo_canceller.enabled = true;
-  DebugDumpGenerator generator(config, apm_config, true);
+  DebugDumpGenerator generator(config, apm_config);
   generator.StartRecording();
   generator.Process(100);
   generator.StopRecording();
@@ -492,6 +461,8 @@
     if (event->type() == audioproc::Event::CONFIG) {
       const audioproc::Config* msg = &event->config();
       ASSERT_TRUE(msg->has_experiments_description());
+      EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "Legacy AEC",
+                          msg->experiments_description().c_str());
       EXPECT_PRED_FORMAT2(testing::IsSubstring, "EchoController",
                           msg->experiments_description().c_str());
     }
@@ -545,23 +516,6 @@
   }
 }
 
-TEST_F(DebugDumpTest, ToggleAecLevel) {
-  Config config;
-  AudioProcessing::Config apm_config;
-  apm_config.echo_canceller.enabled = true;
-  apm_config.echo_canceller.mobile_mode = false;
-  apm_config.echo_canceller.legacy_moderate_suppression_level = true;
-  DebugDumpGenerator generator(config, apm_config);
-  generator.StartRecording();
-  generator.Process(100);
-
-  apm_config.echo_canceller.legacy_moderate_suppression_level = false;
-  generator.apm()->ApplyConfig(apm_config);
-  generator.Process(100);
-  generator.StopRecording();
-  VerifyDebugDump(generator.dump_file_name());
-}
-
 // AGC is not supported on Android or iOS.
 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
 #define MAYBE_ToggleAgc DISABLED_ToggleAgc