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}
This commit is contained in:
Hanna Silen
2021-05-20 17:37:56 +02:00
committed by WebRTC LUCI CQ
parent e2b9fc6909
commit b8dc7fa5a6
6 changed files with 145 additions and 52 deletions

View File

@ -59,9 +59,9 @@ class CustomProcessing;
//
// 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 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
// 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;