APM: move `AnalogGainStatsReporter` to AGC2

Bug: webrtc:7494
Change-Id: Ifb924e6eda47dd96a591a0b55b1e7fcfdbbbbe18
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280222
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38464}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 18d99e5..9af11db 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -202,9 +202,9 @@
     "aec_dump:aec_dump",
     "aecm:aecm_core",
     "agc",
-    "agc:analog_gain_stats_reporter",
     "agc:gain_control_interface",
     "agc:legacy_agc",
+    "agc2:input_volume_stats_reporter",
     "capture_levels_adjuster",
     "ns",
     "transient:transient_suppressor_api",
@@ -419,6 +419,7 @@
         "agc2:biquad_filter_unittests",
         "agc2:fixed_digital_unittests",
         "agc2:input_volume_controller_unittests",
+        "agc2:input_volume_stats_reporter_unittests",
         "agc2:noise_estimator_unittests",
         "agc2:test_utils",
         "agc2:vad_wrapper_unittests",
diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn
index 2a4ec05..24402e5 100644
--- a/modules/audio_processing/agc/BUILD.gn
+++ b/modules/audio_processing/agc/BUILD.gn
@@ -41,20 +41,6 @@
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
 }
 
-rtc_library("analog_gain_stats_reporter") {
-  sources = [
-    "analog_gain_stats_reporter.cc",
-    "analog_gain_stats_reporter.h",
-  ]
-  deps = [
-    "../../../rtc_base:gtest_prod",
-    "../../../rtc_base:logging",
-    "../../../rtc_base:safe_minmax",
-    "../../../system_wrappers:metrics",
-  ]
-  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
-}
-
 rtc_library("level_estimation") {
   sources = [
     "agc.cc",
@@ -109,7 +95,6 @@
     testonly = true
     sources = [
       "agc_manager_direct_unittest.cc",
-      "analog_gain_stats_reporter_unittest.cc",
       "loudness_histogram_unittest.cc",
       "mock_agc.h",
     ]
@@ -117,7 +102,6 @@
 
     deps = [
       ":agc",
-      ":analog_gain_stats_reporter",
       ":gain_control_interface",
       ":level_estimation",
       "..:mocks",
diff --git a/modules/audio_processing/agc2/BUILD.gn b/modules/audio_processing/agc2/BUILD.gn
index d39e327..976f96e 100644
--- a/modules/audio_processing/agc2/BUILD.gn
+++ b/modules/audio_processing/agc2/BUILD.gn
@@ -381,3 +381,27 @@
     "../../../rtc_base:random",
   ]
 }
+
+rtc_library("input_volume_stats_reporter") {
+  sources = [
+    "input_volume_stats_reporter.cc",
+    "input_volume_stats_reporter.h",
+  ]
+  deps = [
+    "../../../rtc_base:gtest_prod",
+    "../../../rtc_base:logging",
+    "../../../rtc_base:safe_minmax",
+    "../../../system_wrappers:metrics",
+  ]
+  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
+
+rtc_library("input_volume_stats_reporter_unittests") {
+  testonly = true
+  sources = [ "input_volume_stats_reporter_unittest.cc" ]
+  deps = [
+    ":input_volume_stats_reporter",
+    "../../../system_wrappers:metrics",
+    "../../../test:test_support",
+  ]
+}
diff --git a/modules/audio_processing/agc/analog_gain_stats_reporter.cc b/modules/audio_processing/agc2/input_volume_stats_reporter.cc
similarity index 98%
rename from modules/audio_processing/agc/analog_gain_stats_reporter.cc
rename to modules/audio_processing/agc2/input_volume_stats_reporter.cc
index 0d8753a..b2c1831 100644
--- a/modules/audio_processing/agc/analog_gain_stats_reporter.cc
+++ b/modules/audio_processing/agc2/input_volume_stats_reporter.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/audio_processing/agc/analog_gain_stats_reporter.h"
+#include "modules/audio_processing/agc2/input_volume_stats_reporter.h"
 
 #include <cmath>
 
diff --git a/modules/audio_processing/agc/analog_gain_stats_reporter.h b/modules/audio_processing/agc2/input_volume_stats_reporter.h
similarity index 91%
rename from modules/audio_processing/agc/analog_gain_stats_reporter.h
rename to modules/audio_processing/agc2/input_volume_stats_reporter.h
index c9442e8..fd048cf 100644
--- a/modules/audio_processing/agc/analog_gain_stats_reporter.h
+++ b/modules/audio_processing/agc2/input_volume_stats_reporter.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_AUDIO_PROCESSING_AGC_ANALOG_GAIN_STATS_REPORTER_H_
-#define MODULES_AUDIO_PROCESSING_AGC_ANALOG_GAIN_STATS_REPORTER_H_
+#ifndef MODULES_AUDIO_PROCESSING_AGC2_INPUT_VOLUME_STATS_REPORTER_H_
+#define MODULES_AUDIO_PROCESSING_AGC2_INPUT_VOLUME_STATS_REPORTER_H_
 
 #include "absl/types/optional.h"
 #include "rtc_base/gtest_prod_util.h"
@@ -64,4 +64,4 @@
 };
 }  // namespace webrtc
 
-#endif  // MODULES_AUDIO_PROCESSING_AGC_ANALOG_GAIN_STATS_REPORTER_H_
+#endif  // MODULES_AUDIO_PROCESSING_AGC2_INPUT_VOLUME_STATS_REPORTER_H_
diff --git a/modules/audio_processing/agc/analog_gain_stats_reporter_unittest.cc b/modules/audio_processing/agc2/input_volume_stats_reporter_unittest.cc
similarity index 98%
rename from modules/audio_processing/agc/analog_gain_stats_reporter_unittest.cc
rename to modules/audio_processing/agc2/input_volume_stats_reporter_unittest.cc
index bc95590..196b1e0 100644
--- a/modules/audio_processing/agc/analog_gain_stats_reporter_unittest.cc
+++ b/modules/audio_processing/agc2/input_volume_stats_reporter_unittest.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/audio_processing/agc/analog_gain_stats_reporter.h"
+#include "modules/audio_processing/agc2/input_volume_stats_reporter.h"
 
 #include "system_wrappers/include/metrics.h"
 #include "test/gmock.h"
diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h
index 0f1ba51..3dfa8ce 100644
--- a/modules/audio_processing/audio_processing_impl.h
+++ b/modules/audio_processing/audio_processing_impl.h
@@ -25,8 +25,8 @@
 #include "api/function_view.h"
 #include "modules/audio_processing/aec3/echo_canceller3.h"
 #include "modules/audio_processing/agc/agc_manager_direct.h"
-#include "modules/audio_processing/agc/analog_gain_stats_reporter.h"
 #include "modules/audio_processing/agc/gain_control.h"
+#include "modules/audio_processing/agc2/input_volume_stats_reporter.h"
 #include "modules/audio_processing/audio_buffer.h"
 #include "modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster.h"
 #include "modules/audio_processing/echo_control_mobile_impl.h"