AGC2: VadWithLevel -> VoiceActivityDetectorWrapper 1/2
Internal refactoring of AGC2. This CL is needed in preparation for its
child CL to correctly show the upcoming changes in the diff.
Bug: webrtc:7494
Change-Id: If7f837e064243d5ffe09e21fc68f489bb00dfdc5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234527
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35170}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index d6ed3e2..3712527 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -372,8 +372,8 @@
"agc2:biquad_filter_unittests",
"agc2:fixed_digital_unittests",
"agc2:noise_estimator_unittests",
- "agc2:rnn_vad_with_level_unittests",
"agc2:test_utils",
+ "agc2:vad_wrapper_unittests",
"agc2/rnn_vad:unittests",
"capture_levels_adjuster",
"capture_levels_adjuster:capture_levels_adjuster_unittests",
diff --git a/modules/audio_processing/agc2/BUILD.gn b/modules/audio_processing/agc2/BUILD.gn
index 734e98f..6fd8b91 100644
--- a/modules/audio_processing/agc2/BUILD.gn
+++ b/modules/audio_processing/agc2/BUILD.gn
@@ -36,7 +36,7 @@
":cpu_features",
":gain_applier",
":noise_level_estimator",
- ":rnn_vad_with_level",
+ ":vad_wrapper",
"..:api",
"..:apm_logging",
"..:audio_frame_view",
@@ -127,10 +127,10 @@
configs += [ "..:apm_debug_dump" ]
}
-rtc_library("rnn_vad_with_level") {
+rtc_library("vad_wrapper") {
sources = [
- "vad_with_level.cc",
- "vad_with_level.h",
+ "vad_wrapper.cc",
+ "vad_wrapper.h",
]
defines = []
@@ -249,12 +249,12 @@
]
}
-rtc_library("rnn_vad_with_level_unittests") {
+rtc_library("vad_wrapper_unittests") {
testonly = true
- sources = [ "vad_with_level_unittest.cc" ]
+ sources = [ "vad_wrapper_unittest.cc" ]
deps = [
":common",
- ":rnn_vad_with_level",
+ ":vad_wrapper",
"..:audio_frame_view",
"../../../rtc_base:gunit_helpers",
"../../../rtc_base:safe_compare",
diff --git a/modules/audio_processing/agc2/adaptive_agc.cc b/modules/audio_processing/agc2/adaptive_agc.cc
index 3f82d00..ab1822d 100644
--- a/modules/audio_processing/agc2/adaptive_agc.cc
+++ b/modules/audio_processing/agc2/adaptive_agc.cc
@@ -12,7 +12,7 @@
#include "common_audio/include/audio_util.h"
#include "modules/audio_processing/agc2/cpu_features.h"
-#include "modules/audio_processing/agc2/vad_with_level.h"
+#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
diff --git a/modules/audio_processing/agc2/adaptive_agc.h b/modules/audio_processing/agc2/adaptive_agc.h
index 43c7787..8ee8378 100644
--- a/modules/audio_processing/agc2/adaptive_agc.h
+++ b/modules/audio_processing/agc2/adaptive_agc.h
@@ -17,7 +17,7 @@
#include "modules/audio_processing/agc2/adaptive_mode_level_estimator.h"
#include "modules/audio_processing/agc2/noise_level_estimator.h"
#include "modules/audio_processing/agc2/saturation_protector.h"
-#include "modules/audio_processing/agc2/vad_with_level.h"
+#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/include/audio_frame_view.h"
#include "modules/audio_processing/include/audio_processing.h"
diff --git a/modules/audio_processing/agc2/adaptive_mode_level_estimator.h b/modules/audio_processing/agc2/adaptive_mode_level_estimator.h
index e15c6af..14da6b7 100644
--- a/modules/audio_processing/agc2/adaptive_mode_level_estimator.h
+++ b/modules/audio_processing/agc2/adaptive_mode_level_estimator.h
@@ -12,10 +12,11 @@
#define MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_MODE_LEVEL_ESTIMATOR_H_
#include <stddef.h>
+
#include <type_traits>
#include "modules/audio_processing/agc2/agc2_common.h"
-#include "modules/audio_processing/agc2/vad_with_level.h"
+#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/include/audio_processing.h"
namespace webrtc {
diff --git a/modules/audio_processing/agc2/rnn_vad/BUILD.gn b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
index bc848b3..f0d7093 100644
--- a/modules/audio_processing/agc2/rnn_vad/BUILD.gn
+++ b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
@@ -57,7 +57,7 @@
# TODO(alessiob): Make this target visibility private.
visibility = [
":*",
- "..:rnn_vad_with_level",
+ "..:vad_wrapper",
]
sources = [ "common.h" ]
deps = [
diff --git a/modules/audio_processing/agc2/vad_with_level.cc b/modules/audio_processing/agc2/vad_wrapper.cc
similarity index 97%
rename from modules/audio_processing/agc2/vad_with_level.cc
rename to modules/audio_processing/agc2/vad_wrapper.cc
index 9747ca2..94d5f67 100644
--- a/modules/audio_processing/agc2/vad_with_level.cc
+++ b/modules/audio_processing/agc2/vad_wrapper.cc
@@ -8,11 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/audio_processing/agc2/vad_with_level.h"
+#include "modules/audio_processing/agc2/vad_wrapper.h"
#include <algorithm>
#include <array>
#include <cmath>
+#include <utility>
#include "api/array_view.h"
#include "common_audio/include/audio_util.h"
diff --git a/modules/audio_processing/agc2/vad_with_level.h b/modules/audio_processing/agc2/vad_wrapper.h
similarity index 92%
rename from modules/audio_processing/agc2/vad_with_level.h
rename to modules/audio_processing/agc2/vad_wrapper.h
index 8d2ae45..de73eab 100644
--- a/modules/audio_processing/agc2/vad_with_level.h
+++ b/modules/audio_processing/agc2/vad_wrapper.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
-#define MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
+#ifndef MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
+#define MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
#include <memory>
@@ -61,4 +61,4 @@
} // namespace webrtc
-#endif // MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
+#endif // MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
diff --git a/modules/audio_processing/agc2/vad_with_level_unittest.cc b/modules/audio_processing/agc2/vad_wrapper_unittest.cc
similarity index 97%
rename from modules/audio_processing/agc2/vad_with_level_unittest.cc
rename to modules/audio_processing/agc2/vad_wrapper_unittest.cc
index ec8e476..a6e776c 100644
--- a/modules/audio_processing/agc2/vad_with_level_unittest.cc
+++ b/modules/audio_processing/agc2/vad_wrapper_unittest.cc
@@ -8,10 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/audio_processing/agc2/vad_with_level.h"
+#include "modules/audio_processing/agc2/vad_wrapper.h"
#include <limits>
#include <memory>
+#include <tuple>
+#include <utility>
#include <vector>
#include "modules/audio_processing/agc2/agc2_common.h"
@@ -61,7 +63,7 @@
// 10 ms mono frame.
struct FrameWithView {
// Ctor. Initializes the frame samples with `value`.
- FrameWithView(float value = 0.0f)
+ explicit FrameWithView(float value = 0.0f)
: channel0(samples.data()),
view(&channel0, /*num_channels=*/1, samples.size()) {
samples.fill(value);