Move AGC2 config ToString to the right place and update Validate()

The APM config to string mapping must be in one place (namely,
in `audio_processing.cc`). This CL moves the AGC2 config to string
impl to the right place.

This CL also updates `GainController2::Validate()` and adds the
missing unit tests for the parameters that have recently been added.

Stack buffer size in `AudioProcessing::Config::ToString()` increased
because of the extra params. Syntax near `multi_channel_capture` fixed.
Output string format verified with a JS linter.

Bug: webrtc:7494
Change-Id: I692e1549b7d40c970d88a14c8e83da16325fb54c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187080
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32400}
This commit is contained in:
Alessio Bazzica
2020-10-14 12:49:54 +02:00
committed by Commit Bot
parent 47156e27c0
commit 0c83e15c6b
5 changed files with 129 additions and 92 deletions

View File

@ -611,10 +611,8 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
const bool config_ok = GainController2::Validate(config_.gain_controller2);
if (!config_ok) {
RTC_LOG(LS_ERROR) << "AudioProcessing module config error\n"
"Gain Controller 2: "
<< GainController2::ToString(config_.gain_controller2)
<< "\nReverting to default parameter set";
RTC_LOG(LS_ERROR)
<< "Invalid Gain Controller 2 config; using the default config.";
config_.gain_controller2 = AudioProcessing::Config::GainController2();
}