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}
diff --git a/modules/audio_processing/include/audio_processing.cc b/modules/audio_processing/include/audio_processing.cc
index 8854415..30e16e4 100644
--- a/modules/audio_processing/include/audio_processing.cc
+++ b/modules/audio_processing/include/audio_processing.cc
@@ -71,19 +71,15 @@
: maximum_internal_processing_rate(GetDefaultMaxInternalRate()) {}
std::string AudioProcessing::Config::ToString() const {
- char buf[1024];
+ char buf[2048];
rtc::SimpleStringBuilder builder(buf);
builder << "AudioProcessing::Config{ "
"pipeline: {"
"maximum_internal_processing_rate: "
<< pipeline.maximum_internal_processing_rate
<< ", multi_channel_render: " << pipeline.multi_channel_render
- << ", "
- ", multi_channel_capture: "
- << pipeline.multi_channel_capture
- << "}, "
- "pre_amplifier: { enabled: "
- << pre_amplifier.enabled
+ << ", multi_channel_capture: " << pipeline.multi_channel_capture
+ << "}, pre_amplifier: { enabled: " << pre_amplifier.enabled
<< ", fixed_gain_factor: " << pre_amplifier.fixed_gain_factor
<< " }, high_pass_filter: { enabled: " << high_pass_filter.enabled
<< " }, echo_canceller: { enabled: " << echo_canceller.enabled
@@ -106,18 +102,29 @@
<< " }, gain_controller2: { enabled: " << gain_controller2.enabled
<< ", fixed_digital: { gain_db: "
<< gain_controller2.fixed_digital.gain_db
- << " }, adaptive_digital: { enabled: "
- << gain_controller2.adaptive_digital.enabled << ", level_estimator: "
+ << "}, adaptive_digital: { enabled: "
+ << gain_controller2.adaptive_digital.enabled
+ << ", level_estimator: { type: "
<< GainController2LevelEstimatorToString(
gain_controller2.adaptive_digital.level_estimator)
- << ", use_saturation_protector: "
- << gain_controller2.adaptive_digital.use_saturation_protector
+ << ", adjacent_speech_frames_threshold: "
+ << gain_controller2.adaptive_digital
+ .level_estimator_adjacent_speech_frames_threshold
+ << ", initial_saturation_margin_db: "
+ << gain_controller2.adaptive_digital.initial_saturation_margin_db
<< ", extra_saturation_margin_db: "
<< gain_controller2.adaptive_digital.extra_saturation_margin_db
+ << "}, gain_applier: { adjacent_speech_frames_threshold: "
+ << gain_controller2.adaptive_digital
+ .gain_applier_adjacent_speech_frames_threshold
+ << ", max_gain_change_db_per_second: "
+ << gain_controller2.adaptive_digital.max_gain_change_db_per_second
+ << ", max_output_noise_level_dbfs: "
+ << gain_controller2.adaptive_digital.max_output_noise_level_dbfs
<< " } }, residual_echo_detector: { enabled: "
<< residual_echo_detector.enabled
<< " }, level_estimation: { enabled: " << level_estimation.enabled
- << " } }";
+ << " }}}";
return builder.str();
}