AEC3: Enable unbounded echo spectrum for dominant nearend detection by default

This change improves echo canceller transparency by enabling the use
of a non-capped ERLE when computing the residual echo spectrum for
dominant nearend detection.

Experimentation has shown that the feature improves echo canceller
transparency and user ratings.

Implementation CL:
https://webrtc-review.googlesource.com/c/src/+/221920

Bug: webrtc:12870
Change-Id: I7dc66810e8300cd35321bcd5b9fae9bc3386836d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234841
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35186}
diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h
index 0df6450..c2ee797 100644
--- a/api/audio/echo_canceller3_config.h
+++ b/api/audio/echo_canceller3_config.h
@@ -209,6 +209,7 @@
       int hold_duration = 50;
       int trigger_threshold = 12;
       bool use_during_initial_phase = true;
+      bool use_unbounded_echo_spectrum = true;
     } dominant_nearend_detection;
 
     struct SubbandNearendDetection {
diff --git a/api/audio/echo_canceller3_config_json.cc b/api/audio/echo_canceller3_config_json.cc
index f6ffd57..71966c1 100644
--- a/api/audio/echo_canceller3_config_json.cc
+++ b/api/audio/echo_canceller3_config_json.cc
@@ -374,6 +374,9 @@
       ReadParam(
           subsection, "use_during_initial_phase",
           &cfg.suppressor.dominant_nearend_detection.use_during_initial_phase);
+      ReadParam(subsection, "use_unbounded_echo_spectrum",
+                &cfg.suppressor.dominant_nearend_detection
+                     .use_unbounded_echo_spectrum);
     }
 
     if (rtc::GetValueFromJsonObject(section, "subband_nearend_detection",
@@ -684,20 +687,20 @@
       << config.suppressor.last_lf_smoothing_band << ",";
   ost << "\"last_lf_band\": " << config.suppressor.last_lf_band << ",";
   ost << "\"first_hf_band\": " << config.suppressor.first_hf_band << ",";
-  ost << "\"dominant_nearend_detection\": {";
-  ost << "\"enr_threshold\": "
-      << config.suppressor.dominant_nearend_detection.enr_threshold << ",";
-  ost << "\"enr_exit_threshold\": "
-      << config.suppressor.dominant_nearend_detection.enr_exit_threshold << ",";
-  ost << "\"snr_threshold\": "
-      << config.suppressor.dominant_nearend_detection.snr_threshold << ",";
-  ost << "\"hold_duration\": "
-      << config.suppressor.dominant_nearend_detection.hold_duration << ",";
-  ost << "\"trigger_threshold\": "
-      << config.suppressor.dominant_nearend_detection.trigger_threshold << ",";
-  ost << "\"use_during_initial_phase\": "
-      << config.suppressor.dominant_nearend_detection.use_during_initial_phase;
-  ost << "},";
+  {
+    const auto& dnd = config.suppressor.dominant_nearend_detection;
+    ost << "\"dominant_nearend_detection\": {";
+    ost << "\"enr_threshold\": " << dnd.enr_threshold << ",";
+    ost << "\"enr_exit_threshold\": " << dnd.enr_exit_threshold << ",";
+    ost << "\"snr_threshold\": " << dnd.snr_threshold << ",";
+    ost << "\"hold_duration\": " << dnd.hold_duration << ",";
+    ost << "\"trigger_threshold\": " << dnd.trigger_threshold << ",";
+    ost << "\"use_during_initial_phase\": " << dnd.use_during_initial_phase
+        << ",";
+    ost << "\"use_unbounded_echo_spectrum\": "
+        << dnd.use_unbounded_echo_spectrum;
+    ost << "},";
+  }
   ost << "\"subband_nearend_detection\": {";
   ost << "\"nearend_average_blocks\": "
       << config.suppressor.subband_nearend_detection.nearend_average_blocks
diff --git a/modules/audio_processing/aec3/suppression_gain.cc b/modules/audio_processing/aec3/suppression_gain.cc
index 6405d71..14366f1 100644
--- a/modules/audio_processing/aec3/suppression_gain.cc
+++ b/modules/audio_processing/aec3/suppression_gain.cc
@@ -28,10 +28,6 @@
 namespace webrtc {
 namespace {
 
-bool UseUnboundedEchoSpectrum() {
-  return field_trial::IsEnabled("WebRTC-Aec3UseUnboundedEchoSpectrum");
-}
-
 void LimitLowFrequencyGains(std::array<float, kFftLengthBy2Plus1>* gain) {
   // Limit the low frequency gains to avoid the impact of the high-pass filter
   // on the lower-frequency gain influencing the overall achieved gain.
@@ -348,7 +344,8 @@
       normal_params_(config_.suppressor.last_lf_band,
                      config_.suppressor.first_hf_band,
                      config_.suppressor.normal_tuning),
-      use_unbounded_echo_spectrum_(UseUnboundedEchoSpectrum()) {
+      use_unbounded_echo_spectrum_(config.suppressor.dominant_nearend_detection
+                                       .use_unbounded_echo_spectrum) {
   RTC_DCHECK_LT(0, state_change_duration_blocks_);
   last_gain_.fill(1.f);
   if (config_.suppressor.use_subband_nearend_detection) {
@@ -382,7 +379,7 @@
   RTC_DCHECK(high_bands_gain);
   RTC_DCHECK(low_band_gain);
 
-  // Choose residual echo spectrum for the dominant nearend detector.
+  // Choose residual echo spectrum for dominant nearend detection.
   const auto echo = use_unbounded_echo_spectrum_
                         ? residual_echo_spectrum_unbounded
                         : residual_echo_spectrum;