Make AgcManagerDirect clipping parameters configurable Bug: webrtc:12774 Change-Id: I99824b5aabe6f921a5db425dd1c1c1d4c606186c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219681 Commit-Queue: Hanna Silen <silen@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34069}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index 6bc50f0..6622097 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h
@@ -59,9 +59,9 @@ // // Must be provided through AudioProcessingBuilder().Create(config). #if defined(WEBRTC_CHROMIUM_BUILD) -static const int kAgcStartupMinVolume = 85; +static constexpr int kAgcStartupMinVolume = 85; #else -static const int kAgcStartupMinVolume = 0; +static constexpr int kAgcStartupMinVolume = 0; #endif // defined(WEBRTC_CHROMIUM_BUILD) static constexpr int kClippedLevelMin = 70; @@ -334,6 +334,15 @@ // clipping. int clipped_level_min = kClippedLevelMin; bool enable_digital_adaptive = true; + // Amount the microphone level is lowered with every clipping event. + // Limited to (0, 255]. + int clipped_level_step = 15; + // Proportion of clipped samples required to declare a clipping event. + // Limited to (0.f, 1.f). + float clipped_ratio_threshold = 0.1f; + // Time in frames to wait after a clipping event before checking again. + // Limited to values higher than 0. + int clipped_wait_frames = 300; } analog_gain_controller; } gain_controller1;