diff --git a/modules/audio_processing/test/aec_dump_based_simulator.cc b/modules/audio_processing/test/aec_dump_based_simulator.cc index 621c3a43d0..ec35dd345c 100644 --- a/modules/audio_processing/test/aec_dump_based_simulator.cc +++ b/modules/audio_processing/test/aec_dump_based_simulator.cc @@ -164,15 +164,14 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall( } } - if (!settings_.use_ts || *settings_.use_ts == 1) { - // Transient suppressor activated (1) or not specified. + if (settings_.override_key_pressed.has_value()) { + // Key pressed state overridden. + ap_->set_stream_key_pressed(*settings_.override_key_pressed); + } else { + // Set the recorded key pressed state. if (msg.has_keypress()) { ap_->set_stream_key_pressed(msg.keypress()); } - } else { - // 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. diff --git a/modules/audio_processing/test/audio_processing_simulator.h b/modules/audio_processing/test/audio_processing_simulator.h index 71f8eab160..b63bc12d6f 100644 --- a/modules/audio_processing/test/audio_processing_simulator.h +++ b/modules/audio_processing/test/audio_processing_simulator.h @@ -119,6 +119,7 @@ struct SimulationSettings { absl::optional analog_mic_gain_emulation_initial_level; absl::optional ns_level; absl::optional ns_analysis_on_linear_aec_output; + absl::optional override_key_pressed; absl::optional maximum_internal_processing_rate; int initial_mic_level; bool simulate_mic_gain = false; diff --git a/modules/audio_processing/test/audioproc_float_impl.cc b/modules/audio_processing/test/audioproc_float_impl.cc index 9055b64081..dc38172666 100644 --- a/modules/audio_processing/test/audioproc_float_impl.cc +++ b/modules/audio_processing/test/audioproc_float_impl.cc @@ -111,8 +111,7 @@ ABSL_FLAG(int, ABSL_FLAG(int, ts, kParameterNotSpecifiedValue, - "Activate (1), deactivate (0) or activate the transient suppressor " - "with continuous key events (2)"); + "Activate (1) or deactivate (0) the transient suppressor"); ABSL_FLAG(int, analog_agc, kParameterNotSpecifiedValue, @@ -218,6 +217,12 @@ ABSL_FLAG(int, simulated_mic_kind, kParameterNotSpecifiedValue, "Specify which microphone kind to use for microphone simulation"); +ABSL_FLAG(int, + override_key_pressed, + kParameterNotSpecifiedValue, + "Always set to true (1) or to false (0) the key press state. If " + "unspecified, false is set with Wav files or, with AEC dumps, the " + "recorded event is used."); ABSL_FLAG(int, frame_for_sending_capture_output_used_false, kParameterNotSpecifiedValue, @@ -459,6 +464,8 @@ SimulationSettings CreateSettings() { settings.simulate_mic_gain = absl::GetFlag(FLAGS_simulate_mic_gain); SetSettingIfSpecified(absl::GetFlag(FLAGS_simulated_mic_kind), &settings.simulated_mic_kind); + SetSettingIfFlagSet(absl::GetFlag(FLAGS_override_key_pressed), + &settings.override_key_pressed); SetSettingIfSpecified( absl::GetFlag(FLAGS_frame_for_sending_capture_output_used_false), &settings.frame_for_sending_capture_output_used_false); diff --git a/modules/audio_processing/test/wav_based_simulator.cc b/modules/audio_processing/test/wav_based_simulator.cc index 10c0d3717e..52a05a3871 100644 --- a/modules/audio_processing/test/wav_based_simulator.cc +++ b/modules/audio_processing/test/wav_based_simulator.cc @@ -82,7 +82,7 @@ void WavBasedSimulator::PrepareProcessStreamCall() { if (settings_.fixed_interface) { fwd_frame_.CopyFrom(*in_buf_); } - ap_->set_stream_key_pressed(settings_.use_ts && (*settings_.use_ts)); + ap_->set_stream_key_pressed(settings_.override_key_pressed.value_or(false)); if (!settings_.use_stream_delay || *settings_.use_stream_delay) { RTC_CHECK_EQ(AudioProcessing::kNoError,