Commit b94bc460 authored by Alessio Bazzica's avatar Alessio Bazzica Committed by Commit Bot

WebRTC AGC Hybrid experiment: wire-up AGC2 params

ConfigAutomaticGainControl now supports two additional AGC2 params that
are needed for experimentation.

Tested: checked feature activation via AECdump using appr.tc
$ out/Default/Chromium.app/Contents/MacOS/Chromium \
  --enable-features=WebrtcHybridAgc

Bug: webrtc:7494
Change-Id: I81225ebc05a66ca18e5c4b2edc350cd42f19c31a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446052
Commit-Queue: Ale Bzk <alessiob@chromium.org>
Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813741}
parent f9890a19
......@@ -607,6 +607,12 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
base::GetFieldTrialParamByFeatureAsInt(
features::kWebRtcHybridAgc,
"gain_applier_speech_frames_threshold", 1);
agc2_properties->max_gain_change_db_per_second =
base::GetFieldTrialParamByFeatureAsInt(
features::kWebRtcHybridAgc, "max_gain_change_db_per_second", 3);
agc2_properties->max_output_noise_level_dbfs =
base::GetFieldTrialParamByFeatureAsInt(
features::kWebRtcHybridAgc, "max_output_noise_level_dbfs", -50);
}
blink::ConfigAutomaticGainControl(
properties.goog_auto_gain_control,
......
......@@ -240,6 +240,12 @@ void ConfigAutomaticGainControl(
adaptive_digital.gain_applier_adjacent_speech_frames_threshold =
agc2_properties->gain_applier_speech_frames_threshold;
adaptive_digital.max_gain_change_db_per_second =
agc2_properties->max_gain_change_db_per_second;
adaptive_digital.max_output_noise_level_dbfs =
agc2_properties->max_output_noise_level_dbfs;
}
} else if (use_fixed_digital_agc2) {
// Experimental AGC is disabled, thus hybrid AGC is disabled. Config AGC2
......
......@@ -123,6 +123,8 @@ struct PLATFORM_EXPORT AdaptiveGainController2Properties {
int initial_saturation_margin_db;
int extra_saturation_margin_db;
int gain_applier_speech_frames_threshold;
int max_gain_change_db_per_second;
int max_output_noise_level_dbfs;
};
// Configures automatic gain control in `apm_config`. If `agc_enabled` is true
......
......@@ -49,6 +49,8 @@ TEST(ConfigAutomaticGainControlTest, EnableHybridAGC) {
agc2_properties.initial_saturation_margin_db = 10;
agc2_properties.extra_saturation_margin_db = 10;
agc2_properties.gain_applier_speech_frames_threshold = 5;
agc2_properties.max_gain_change_db_per_second = 4;
agc2_properties.max_output_noise_level_dbfs = -22;
const double compression_gain_db = 10.0;
ConfigAutomaticGainControl(
......@@ -82,6 +84,10 @@ TEST(ConfigAutomaticGainControlTest, EnableHybridAGC) {
agc2_properties.extra_saturation_margin_db);
EXPECT_EQ(adaptive_digital.gain_applier_adjacent_speech_frames_threshold,
agc2_properties.gain_applier_speech_frames_threshold);
EXPECT_FLOAT_EQ(adaptive_digital.max_gain_change_db_per_second,
agc2_properties.max_gain_change_db_per_second);
EXPECT_FLOAT_EQ(adaptive_digital.max_output_noise_level_dbfs,
agc2_properties.max_output_noise_level_dbfs);
}
TEST(PopulateApmConfigTest, DefaultWithoutConfigJson) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment