AGC2 Input Volume Controller: min input volume field trial update

Always enforce the minimum input volume, not only if overridden.
The only exception is when the applied input volume is zero: in that
case zero is still recommended.

This CL also adapts the unit tests and replaces "mic level" with
the "input volume".

Bug: webrtc:7494
Change-Id: I20c14624fbd357ab91ea05521c3723ec1045a8db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285462
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38769}
This commit is contained in:
Alessio Bazzica
2022-11-29 13:49:29 +01:00
committed by WebRTC LUCI CQ
parent 8b47ea459e
commit 03bccbe62d
3 changed files with 76 additions and 93 deletions

View File

@ -143,8 +143,8 @@ class InputVolumeController final {
const int num_capture_channels_;
// If not empty, the value is used to override the minimum input volume.
const absl::optional<int> min_mic_level_override_;
// Minimum input volume that can be recommended.
const int min_input_volume_;
// TODO(bugs.webrtc.org/7494): Create a separate member for the applied input
// volume.
@ -220,7 +220,7 @@ class MonoInputVolumeController {
int clipped_level_min() const { return clipped_level_min_; }
// Only used for testing.
int min_mic_level() const { return min_mic_level_; }
int min_input_volume() const { return min_input_volume_; }
private:
// Sets a new input volume, after first checking that it hasn't been updated
@ -238,7 +238,7 @@ class MonoInputVolumeController {
// action and cache the updated level.
void UpdateInputVolume(int rms_error_dbfs);
const int min_mic_level_;
const int min_input_volume_;
int level_ = 0;
int max_level_;