Removed the configuration options for multi_channel processing This CL removes the explicit configuration options for whether the audio processing should be performed in a multi- or single-channel manner. This change means that the choice of whether to do multi- or single-channel audio processing will be made based on the content of the audio sent to APM for processing, and the audio output requested by APM. Bug: chromium:464314991 Change-Id: I55a53f2565c81a7d7ad2e378f944ffcf07c71f4f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/453000 Commit-Queue: Per Åhgren <peah@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47175}
diff --git a/api/audio/audio_processing.cc b/api/audio/audio_processing.cc index bf0af03..12ea953 100644 --- a/api/audio/audio_processing.cc +++ b/api/audio/audio_processing.cc
@@ -131,8 +131,6 @@ "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 << ", fixed_gain_factor: " << pre_amplifier.fixed_gain_factor << " },capture_level_adjustment: { enabled: "
diff --git a/api/audio/audio_processing.h b/api/audio/audio_processing.h index 1e0ea0b..4c3408d 100644 --- a/api/audio/audio_processing.h +++ b/api/audio/audio_processing.h
@@ -146,11 +146,6 @@ // Maximum allowed processing rate used internally. May only be set to // 32000 or 48000 and any differing values will be treated as 48000. int maximum_internal_processing_rate = 32000; - // Allow multi-channel processing of render audio. - bool multi_channel_render = true; - // Allow multi-channel processing of capture audio when AEC3 is active - // or a custom AEC is injected. - bool multi_channel_capture = true; // Indicates how to downmix multi-channel capture audio to mono (when // needed). DownmixMethod capture_downmix_method = DownmixMethod::kAverageChannels;
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index e86cc3c..2956078 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc
@@ -468,10 +468,6 @@ std::move(capture_analyzer), std::move(neural_residual_echo_estimator)), constants_( - !env.field_trials().IsEnabled( - "WebRTC-ApmExperimentalMultiChannelRenderKillSwitch"), - !env.field_trials().IsEnabled( - "WebRTC-ApmExperimentalMultiChannelCaptureKillSwitch"), EnforceSplitBandHpf(env.field_trials()), MinimizeProcessingForUnusedOutput(env.field_trials()), env.field_trials().IsEnabled("WebRTC-ApmEnforce48kHzProcessingRate")), @@ -653,16 +649,9 @@ render_processing_rate == 48000); if (submodule_states_.RenderMultiBandSubModulesActive()) { - // By default, downmix the render stream to mono for analysis. This has been - // demonstrated to work well for AEC in most practical scenarios. - const bool multi_channel_render = config_.pipeline.multi_channel_render && - constants_.multi_channel_render_support; - int render_processing_num_channels = - multi_channel_render - ? formats_.api_format.reverse_input_stream().num_channels() - : 1; formats_.render_processing_format = - StreamConfig(render_processing_rate, render_processing_num_channels); + StreamConfig(render_processing_rate, + formats_.api_format.reverse_input_stream().num_channels()); } else { formats_.render_processing_format = StreamConfig( formats_.api_format.reverse_input_stream().sample_rate_hz(), @@ -680,10 +669,6 @@ RTC_LOG(LS_INFO) << "AudioProcessing::ApplyConfig: " << config.ToString(); const bool pipeline_config_changed = - config_.pipeline.multi_channel_render != - config.pipeline.multi_channel_render || - config_.pipeline.multi_channel_capture != - config.pipeline.multi_channel_capture || config_.pipeline.maximum_internal_processing_rate != config.pipeline.maximum_internal_processing_rate || config_.pipeline.capture_downmix_method != @@ -778,12 +763,6 @@ } size_t AudioProcessingImpl::num_proc_channels() const { - // Used as callback from submodules, hence locking is not allowed. - const bool multi_channel_capture = config_.pipeline.multi_channel_capture && - constants_.multi_channel_capture_support; - if (submodule_states_.EchoControllerEnabled() && !multi_channel_capture) { - return 1; - } return num_output_channels(); } @@ -1312,16 +1291,6 @@ capture_buffer->SplitIntoFrequencyBands(); } - const bool multi_channel_capture = config_.pipeline.multi_channel_capture && - constants_.multi_channel_capture_support; - if (submodules_.echo_controller && !multi_channel_capture) { - // Force down-mixing of the number of channels after the detection of - // capture signal saturation. - // TODO(peah): Look into ensuring that this kind of tampering with the - // AudioBuffer functionality should not be needed. - capture_buffer->set_num_channels(1); - } - if (submodules_.high_pass_filter && (!config_.high_pass_filter.apply_in_full_band || constants_.enforce_split_band_hpf)) {
diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h index c058961..302cf43 100644 --- a/modules/audio_processing/audio_processing_impl.h +++ b/modules/audio_processing/audio_processing_impl.h
@@ -420,20 +420,14 @@ // APM constants. const struct ApmConstants { - ApmConstants(bool multi_channel_render_support, - bool multi_channel_capture_support, - bool enforce_split_band_hpf, + ApmConstants(bool enforce_split_band_hpf, bool minimize_processing_for_unused_output, bool enforce_48_khz_max_internal_processing_rate) - : multi_channel_render_support(multi_channel_render_support), - multi_channel_capture_support(multi_channel_capture_support), - enforce_split_band_hpf(enforce_split_band_hpf), + : enforce_split_band_hpf(enforce_split_band_hpf), minimize_processing_for_unused_output( minimize_processing_for_unused_output), enforce_48_khz_max_internal_processing_rate( enforce_48_khz_max_internal_processing_rate) {} - bool multi_channel_render_support; - bool multi_channel_capture_support; bool enforce_split_band_hpf; bool minimize_processing_for_unused_output; bool enforce_48_khz_max_internal_processing_rate;
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc index 7078370..03472bd 100644 --- a/modules/audio_processing/audio_processing_unittest.cc +++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -2056,8 +2056,6 @@ ArrayView<const int> capture_channel_counts, ArrayView<const bool> mono_capture_output) { AudioProcessing::Config apm_config; - apm_config.pipeline.multi_channel_render = true; - apm_config.pipeline.multi_channel_capture = true; apm_config.echo_canceller.enabled = true; scoped_refptr<AudioProcessing> apm = BuiltinAudioProcessingBuilder(apm_config).Build(CreateEnvironment());
diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index aa1af17..be0a1c6 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc
@@ -418,14 +418,6 @@ if (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; - } - - if (settings_.multi_channel_capture) { - apm_config.pipeline.multi_channel_capture = - *settings_.multi_channel_capture; - } if (settings_.use_adaptive_stereo_downmixing_for_aec) { if (*settings_.use_adaptive_stereo_downmixing_for_aec) {
diff --git a/modules/audio_processing/test/audio_processing_simulator.h b/modules/audio_processing/test/audio_processing_simulator.h index 1bf5c1b..511981c 100644 --- a/modules/audio_processing/test/audio_processing_simulator.h +++ b/modules/audio_processing/test/audio_processing_simulator.h
@@ -128,8 +128,6 @@ std::optional<int> maximum_internal_processing_rate; int initial_mic_level; bool simulate_mic_gain = false; - std::optional<bool> multi_channel_render; - std::optional<bool> multi_channel_capture; std::optional<int> simulated_mic_kind; std::optional<int> frame_for_sending_capture_output_used_false; std::optional<int> frame_for_sending_capture_output_used_true;
diff --git a/modules/audio_processing/test/audioproc_float_impl.cc b/modules/audio_processing/test/audioproc_float_impl.cc index 589fa1a..d41aaed 100644 --- a/modules/audio_processing/test/audioproc_float_impl.cc +++ b/modules/audio_processing/test/audioproc_float_impl.cc
@@ -224,16 +224,6 @@ "Activate (1) or deactivate(0) the analog mic gain simulation in the " "test code"); ABSL_FLAG(int, - multi_channel_render, - kParameterNotSpecifiedValue, - "Activate (1) or deactivate (0) multi-channel render processing in " - "APM pipeline"); -ABSL_FLAG(int, - multi_channel_capture, - kParameterNotSpecifiedValue, - "Activate (1) or deactivate (0) multi-channel capture processing in " - "APM pipeline"); -ABSL_FLAG(int, simulated_mic_kind, kParameterNotSpecifiedValue, "Specify which microphone kind to use for microphone simulation"); @@ -482,10 +472,6 @@ SetSettingIfSpecified(absl::GetFlag(FLAGS_aec_settings), &settings.aec_settings_filename); settings.initial_mic_level = absl::GetFlag(FLAGS_initial_mic_level); - SetSettingIfFlagSet(absl::GetFlag(FLAGS_multi_channel_render), - &settings.multi_channel_render); - SetSettingIfFlagSet(absl::GetFlag(FLAGS_multi_channel_capture), - &settings.multi_channel_capture); settings.simulate_mic_gain = absl::GetFlag(FLAGS_simulate_mic_gain); SetSettingIfSpecified(absl::GetFlag(FLAGS_simulated_mic_kind), &settings.simulated_mic_kind);
diff --git a/test/fuzzers/audio_processing_configs_fuzzer.cc b/test/fuzzers/audio_processing_configs_fuzzer.cc index 614cc66..03ee5f3 100644 --- a/test/fuzzers/audio_processing_configs_fuzzer.cc +++ b/test/fuzzers/audio_processing_configs_fuzzer.cc
@@ -105,8 +105,6 @@ } webrtc::AudioProcessing::Config apm_config; - apm_config.pipeline.multi_channel_render = true; - apm_config.pipeline.multi_channel_capture = true; apm_config.echo_canceller.enabled = use_aec || use_aecm; apm_config.high_pass_filter.enabled = use_hpf; apm_config.gain_controller1.enabled = use_agc;
diff --git a/test/fuzzers/audio_processing_sample_rate_fuzzer.cc b/test/fuzzers/audio_processing_sample_rate_fuzzer.cc index 3f7bec7..e893f02 100644 --- a/test/fuzzers/audio_processing_sample_rate_fuzzer.cc +++ b/test/fuzzers/audio_processing_sample_rate_fuzzer.cc
@@ -94,8 +94,6 @@ : nullptr; scoped_refptr<AudioProcessing> apm = BuiltinAudioProcessingBuilder() - .SetConfig({.pipeline = {.multi_channel_render = true, - .multi_channel_capture = true}}) .SetCapturePostProcessing(std::move(capture_processor)) .SetRenderPreProcessing(std::move(render_processor)) .Build(CreateEnvironment());