From d226c5731dda354c5e211fac27c5f0eba9abaa85 Mon Sep 17 00:00:00 2001 From: Alessio Bazzica Date: Mon, 24 Oct 2022 22:05:19 +0200 Subject: [PATCH] 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 Reviewed-by: Hanna Silen Cr-Commit-Position: refs/heads/main@{#38464} --- modules/audio_processing/BUILD.gn | 3 ++- modules/audio_processing/agc/BUILD.gn | 16 ------------- modules/audio_processing/agc2/BUILD.gn | 24 +++++++++++++++++++ .../input_volume_stats_reporter.cc} | 2 +- .../input_volume_stats_reporter.h} | 6 ++--- .../input_volume_stats_reporter_unittest.cc} | 2 +- .../audio_processing/audio_processing_impl.h | 2 +- 7 files changed, 32 insertions(+), 23 deletions(-) rename modules/audio_processing/{agc/analog_gain_stats_reporter.cc => agc2/input_volume_stats_reporter.cc} (98%) rename modules/audio_processing/{agc/analog_gain_stats_reporter.h => agc2/input_volume_stats_reporter.h} (92%) rename modules/audio_processing/{agc/analog_gain_stats_reporter_unittest.cc => agc2/input_volume_stats_reporter_unittest.cc} (99%) diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn index 18d99e54c1..9af11db449 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -202,9 +202,9 @@ rtc_library("audio_processing") { "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 @@ if (rtc_include_tests) { "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 2a4ec059ff..24402e559a 100644 --- a/modules/audio_processing/agc/BUILD.gn +++ b/modules/audio_processing/agc/BUILD.gn @@ -41,20 +41,6 @@ rtc_library("agc") { 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 @@ if (rtc_include_tests) { 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 @@ if (rtc_include_tests) { 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 d39e3279b4..976f96ec6b 100644 --- a/modules/audio_processing/agc2/BUILD.gn +++ b/modules/audio_processing/agc2/BUILD.gn @@ -381,3 +381,27 @@ rtc_library("test_utils") { "../../../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 0d8753a7c8..b2c183157e 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 diff --git a/modules/audio_processing/agc/analog_gain_stats_reporter.h b/modules/audio_processing/agc2/input_volume_stats_reporter.h similarity index 92% rename from modules/audio_processing/agc/analog_gain_stats_reporter.h rename to modules/audio_processing/agc2/input_volume_stats_reporter.h index c9442e8a43..fd048cf3de 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 @@ class AnalogGainStatsReporter { }; } // 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 99% 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 bc9559094b..196b1e0e36 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 0f1ba519c1..3dfa8cecae 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"