Rework transient suppressor configuration in audioproc_f

The transient suppressor can be configured as:
0 - Deactivated
1 - Activated with key events from aecdump
2 - Activated with continuous key events (for debugging purposes)

Bug: webrtc:5298
Change-Id: I116eb08ad50178dc5116d5d967084e6c9967f258
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211869
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33464}
This commit is contained in:
Gustaf Ullberg 2021-03-15 14:26:40 +01:00 committed by Commit Bot
parent 685be147cb
commit fdd6099348
4 changed files with 29 additions and 23 deletions

View file

@ -164,12 +164,15 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall(
}
}
if (!settings_.use_ts) {
if (!settings_.use_ts || *settings_.use_ts == 1) {
// Transient suppressor activated (1) or not specified.
if (msg.has_keypress()) {
ap_->set_stream_key_pressed(msg.keypress());
}
} else {
ap_->set_stream_key_pressed(*settings_.use_ts);
// Transient suppressor deactivated (0) or activated with continuous key
// events (2).
ap_->set_stream_key_pressed(*settings_.use_ts == 2);
}
// Level is always logged in AEC dumps.

View file

@ -467,7 +467,7 @@ void AudioProcessingSimulator::DetachAecDump() {
void AudioProcessingSimulator::ConfigureAudioProcessor() {
AudioProcessing::Config apm_config;
if (settings_.use_ts) {
apm_config.transient_suppression.enabled = *settings_.use_ts;
apm_config.transient_suppression.enabled = *settings_.use_ts != 0;
}
if (settings_.multi_channel_render) {
apm_config.pipeline.multi_channel_render = *settings_.multi_channel_render;
@ -574,7 +574,9 @@ void AudioProcessingSimulator::ConfigureAudioProcessor() {
ap_->ApplyConfig(apm_config);
if (settings_.use_ts) {
ap_->set_stream_key_pressed(*settings_.use_ts);
// Default to key pressed if activating the transient suppressor with
// continuous key events.
ap_->set_stream_key_pressed(*settings_.use_ts == 2);
}
if (settings_.aec_dump_output_filename) {

View file

@ -101,7 +101,7 @@ struct SimulationSettings {
absl::optional<bool> use_pre_amplifier;
absl::optional<bool> use_hpf;
absl::optional<bool> use_ns;
absl::optional<bool> use_ts;
absl::optional<int> use_ts;
absl::optional<bool> use_analog_agc;
absl::optional<bool> use_vad;
absl::optional<bool> use_le;

View file

@ -101,11 +101,12 @@ ABSL_FLAG(int,
ABSL_FLAG(int,
ts,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the transient suppressor");
"Activate (1), deactivate (0) or activate the transient suppressor "
"with continuous key events (2)");
ABSL_FLAG(int,
analog_agc,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the transient suppressor");
"Activate (1) or deactivate (0) the analog AGC");
ABSL_FLAG(int,
vad,
kParameterNotSpecifiedValue,
@ -415,7 +416,7 @@ SimulationSettings CreateSettings() {
&settings.use_pre_amplifier);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_hpf), &settings.use_hpf);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_ns), &settings.use_ns);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_ts), &settings.use_ts);
SetSettingIfSpecified(absl::GetFlag(FLAGS_ts), &settings.use_ts);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_analog_agc),
&settings.use_analog_agc);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_vad), &settings.use_vad);