APM audioproc_f: adding --override_key_pressed
Add a flag to override the key pressed state when simulating APM. The current behavior changes as follows: - Wav files simulation: instead of simulating continuous key press events only if the transient suppressor (TS) sub-module is active, allow to simulate the events regardless of whether TS is used; the default key pressed state is used if the command line flag is unspecified, otherwise it is overridden (either always false or always true) - AEC dump simulation: instead of simulating continuous key press events when `--ts 2` is specified, allow to simulate the events regardless of whether TS is used; the state recorded in the AEC dump is used if the command line flag is unspecified, otherwise it is overridden (either always false or always true) - The `--ts 2` option (continuous key events) is now equivalent to `--ts 1`. Bug: webrtc:13663 Change-Id: I5ebe96283db73ee235ec2b2795d91d4e241a3527 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256003 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36247}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
017a606836
commit
bb986cbddb
@ -164,15 +164,14 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings_.use_ts || *settings_.use_ts == 1) {
|
if (settings_.override_key_pressed.has_value()) {
|
||||||
// Transient suppressor activated (1) or not specified.
|
// Key pressed state overridden.
|
||||||
|
ap_->set_stream_key_pressed(*settings_.override_key_pressed);
|
||||||
|
} else {
|
||||||
|
// Set the recorded key pressed state.
|
||||||
if (msg.has_keypress()) {
|
if (msg.has_keypress()) {
|
||||||
ap_->set_stream_key_pressed(msg.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.
|
// Level is always logged in AEC dumps.
|
||||||
|
|||||||
@ -119,6 +119,7 @@ struct SimulationSettings {
|
|||||||
absl::optional<float> analog_mic_gain_emulation_initial_level;
|
absl::optional<float> analog_mic_gain_emulation_initial_level;
|
||||||
absl::optional<int> ns_level;
|
absl::optional<int> ns_level;
|
||||||
absl::optional<bool> ns_analysis_on_linear_aec_output;
|
absl::optional<bool> ns_analysis_on_linear_aec_output;
|
||||||
|
absl::optional<bool> override_key_pressed;
|
||||||
absl::optional<int> maximum_internal_processing_rate;
|
absl::optional<int> maximum_internal_processing_rate;
|
||||||
int initial_mic_level;
|
int initial_mic_level;
|
||||||
bool simulate_mic_gain = false;
|
bool simulate_mic_gain = false;
|
||||||
|
|||||||
@ -111,8 +111,7 @@ ABSL_FLAG(int,
|
|||||||
ABSL_FLAG(int,
|
ABSL_FLAG(int,
|
||||||
ts,
|
ts,
|
||||||
kParameterNotSpecifiedValue,
|
kParameterNotSpecifiedValue,
|
||||||
"Activate (1), deactivate (0) or activate the transient suppressor "
|
"Activate (1) or deactivate (0) the transient suppressor");
|
||||||
"with continuous key events (2)");
|
|
||||||
ABSL_FLAG(int,
|
ABSL_FLAG(int,
|
||||||
analog_agc,
|
analog_agc,
|
||||||
kParameterNotSpecifiedValue,
|
kParameterNotSpecifiedValue,
|
||||||
@ -218,6 +217,12 @@ ABSL_FLAG(int,
|
|||||||
simulated_mic_kind,
|
simulated_mic_kind,
|
||||||
kParameterNotSpecifiedValue,
|
kParameterNotSpecifiedValue,
|
||||||
"Specify which microphone kind to use for microphone simulation");
|
"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,
|
ABSL_FLAG(int,
|
||||||
frame_for_sending_capture_output_used_false,
|
frame_for_sending_capture_output_used_false,
|
||||||
kParameterNotSpecifiedValue,
|
kParameterNotSpecifiedValue,
|
||||||
@ -459,6 +464,8 @@ SimulationSettings CreateSettings() {
|
|||||||
settings.simulate_mic_gain = absl::GetFlag(FLAGS_simulate_mic_gain);
|
settings.simulate_mic_gain = absl::GetFlag(FLAGS_simulate_mic_gain);
|
||||||
SetSettingIfSpecified(absl::GetFlag(FLAGS_simulated_mic_kind),
|
SetSettingIfSpecified(absl::GetFlag(FLAGS_simulated_mic_kind),
|
||||||
&settings.simulated_mic_kind);
|
&settings.simulated_mic_kind);
|
||||||
|
SetSettingIfFlagSet(absl::GetFlag(FLAGS_override_key_pressed),
|
||||||
|
&settings.override_key_pressed);
|
||||||
SetSettingIfSpecified(
|
SetSettingIfSpecified(
|
||||||
absl::GetFlag(FLAGS_frame_for_sending_capture_output_used_false),
|
absl::GetFlag(FLAGS_frame_for_sending_capture_output_used_false),
|
||||||
&settings.frame_for_sending_capture_output_used_false);
|
&settings.frame_for_sending_capture_output_used_false);
|
||||||
|
|||||||
@ -82,7 +82,7 @@ void WavBasedSimulator::PrepareProcessStreamCall() {
|
|||||||
if (settings_.fixed_interface) {
|
if (settings_.fixed_interface) {
|
||||||
fwd_frame_.CopyFrom(*in_buf_);
|
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) {
|
if (!settings_.use_stream_delay || *settings_.use_stream_delay) {
|
||||||
RTC_CHECK_EQ(AudioProcessing::kNoError,
|
RTC_CHECK_EQ(AudioProcessing::kNoError,
|
||||||
|
|||||||
Reference in New Issue
Block a user