Reland "Replace the ExperimentalAgc config with the new config format"
This is a reland of f3aa6326b8e21f627b9fba72040122723251999b
Original change's description:
> Replace the ExperimentalAgc config with the new config format
>
> This CL replaces the use of the ExperimentalAgc config with
> using the new config format.
>
> Beyond that, some further changes were made to how the analog
> and digital AGCs are initialized/called. While these can be
> made in a separate CL, I believe the code changes becomes more
> clear by bundling those with the replacement of the
> ExperimentalAgc config.
>
> TBR: saza@webrtc.org
> Bug: webrtc:5298
> Change-Id: Ia19940f3abae048541e6716d0184b4caafc7d53e
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163986
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30149}
Bug: webrtc:5298
Change-Id: I6db03628ed3fa2ecd36544fe9181dd8244d7e2df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165760
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30295}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index fe4b0dc..a41dfa1 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -60,6 +60,10 @@
static const int kAgcStartupMinVolume = 0;
#endif // defined(WEBRTC_CHROMIUM_BUILD)
static constexpr int kClippedLevelMin = 70;
+
+// To be deprecated: Please instead use the flag in the
+// AudioProcessing::Config::AnalogGainController.
+// TODO(webrtc:5298): Remove.
struct ExperimentalAgc {
ExperimentalAgc() = default;
explicit ExperimentalAgc(bool enabled) : enabled(enabled) {}
@@ -314,6 +318,17 @@
// Must be set if an analog mode is used. Limited to [0, 65535].
int analog_level_minimum = 0;
int analog_level_maximum = 255;
+
+ // Enables the analog gain controller functionality.
+ struct AnalogGainController {
+ bool enabled = true;
+ int startup_min_volume = kAgcStartupMinVolume;
+ // Lowest analog microphone level that will be applied in response to
+ // clipping.
+ int clipped_level_min = kClippedLevelMin;
+ bool enable_agc2_level_estimator = false;
+ bool enable_digital_adaptive = true;
+ } analog_gain_controller;
} gain_controller1;
// Enables the next generation AGC functionality. This feature replaces the