Optionally disable digital adaptive AGC2.
The AGC2 is enabled by flipping AudioProcessing::Config::GainController2::enabled. The flag enables both AdaptiveAgc and FixedGainController. Before this CL, there was no way(*) to only enable the FixedGainController. After this CL, it's also possible to flip the setting |AudioProcessing::Config::GainController2::adaptive_digital_mode|. The default is |true|, which is the previous behavior. * Except for instantiating and setting it up outside of the APM like it's done in the AudioMixer. Bug: webrtc:7494 Change-Id: I506e93b6687221ac467f083fa8db3d45c98c1b83 Reviewed-on: https://webrtc-review.googlesource.com/95426 Commit-Queue: Alex Loiko <aleloi@webrtc.org> Reviewed-by: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24432}
This commit is contained in:
@ -41,12 +41,14 @@ void GainController2::Initialize(int sample_rate_hz) {
|
||||
void GainController2::Process(AudioBuffer* audio) {
|
||||
AudioFrameView<float> float_frame(audio->channels_f(), audio->num_channels(),
|
||||
audio->num_frames());
|
||||
adaptive_agc_.Process(float_frame);
|
||||
if (adaptive_digital_mode_) {
|
||||
adaptive_agc_.Process(float_frame);
|
||||
}
|
||||
fixed_gain_controller_.Process(float_frame);
|
||||
}
|
||||
|
||||
void GainController2::NotifyAnalogLevel(int level) {
|
||||
if (analog_level_ != level) {
|
||||
if (analog_level_ != level && adaptive_digital_mode_) {
|
||||
adaptive_agc_.Reset();
|
||||
}
|
||||
analog_level_ = level;
|
||||
@ -57,6 +59,7 @@ void GainController2::ApplyConfig(
|
||||
RTC_DCHECK(Validate(config));
|
||||
config_ = config;
|
||||
fixed_gain_controller_.SetGain(config_.fixed_gain_db);
|
||||
adaptive_digital_mode_ = config_.adaptive_digital_mode;
|
||||
}
|
||||
|
||||
bool GainController2::Validate(
|
||||
|
||||
Reference in New Issue
Block a user