Correct/update the activation of the multi-channel processing in APM

This CL removes the experimental status of the multi-channel processing
in APM, and accordingly updates the variable naming.

It also splits the activation of multi-channel processing to be separate
for render and capture.


Bug: webrtc:10859
Change-Id: I0e5d04dcb94b6637c33d97146231b8ddddbaea39
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160707
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29926}
This commit is contained in:
Per Åhgren 2019-11-27 09:34:22 +01:00 committed by Commit Bot
parent c363982eea
commit e14cb99408
8 changed files with 53 additions and 36 deletions

View File

@ -586,11 +586,10 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) {
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 experimental_multi_channel_render =
config_.pipeline.experimental_multi_channel &&
constants_.experimental_multi_channel_render_support;
const bool multi_channel_render = config_.pipeline.multi_channel_render &&
constants_.multi_channel_render_support;
int render_processing_num_channels =
experimental_multi_channel_render
multi_channel_render
? formats_.api_format.reverse_input_stream().num_channels()
: 1;
formats_.render_processing_format =
@ -622,8 +621,10 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
rtc::CritScope cs_capture(&crit_capture_);
const bool pipeline_config_changed =
config_.pipeline.experimental_multi_channel !=
config.pipeline.experimental_multi_channel;
config_.pipeline.multi_channel_render !=
config.pipeline.multi_channel_render ||
config_.pipeline.multi_channel_capture !=
config.pipeline.multi_channel_capture;
const bool aec_config_changed =
config_.echo_canceller.enabled != config.echo_canceller.enabled ||
@ -769,11 +770,9 @@ size_t AudioProcessingImpl::num_input_channels() const {
size_t AudioProcessingImpl::num_proc_channels() const {
// Used as callback from submodules, hence locking is not allowed.
const bool experimental_multi_channel_capture =
config_.pipeline.experimental_multi_channel &&
constants_.experimental_multi_channel_capture_support;
if (capture_nonlocked_.echo_controller_enabled &&
!experimental_multi_channel_capture) {
const bool multi_channel_capture = config_.pipeline.multi_channel_capture &&
constants_.multi_channel_capture_support;
if (capture_nonlocked_.echo_controller_enabled && !multi_channel_capture) {
return 1;
}
return num_output_channels();
@ -1291,10 +1290,9 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
capture_buffer->SplitIntoFrequencyBands();
}
const bool experimental_multi_channel_capture =
config_.pipeline.experimental_multi_channel &&
constants_.experimental_multi_channel_capture_support;
if (submodules_.echo_controller && !experimental_multi_channel_capture) {
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

View File

@ -374,8 +374,8 @@ class AudioProcessingImpl : public AudioProcessing {
bool use_experimental_agc,
bool use_experimental_agc_agc2_level_estimation,
bool use_experimental_agc_agc2_digital_adaptive,
bool experimental_multi_channel_render_support,
bool experimental_multi_channel_capture_support)
bool multi_channel_render_support,
bool multi_channel_capture_support)
: agc_startup_min_volume(agc_startup_min_volume),
agc_clipped_level_min(agc_clipped_level_min),
use_experimental_agc(use_experimental_agc),
@ -383,17 +383,15 @@ class AudioProcessingImpl : public AudioProcessing {
use_experimental_agc_agc2_level_estimation),
use_experimental_agc_agc2_digital_adaptive(
use_experimental_agc_agc2_digital_adaptive),
experimental_multi_channel_render_support(
experimental_multi_channel_render_support),
experimental_multi_channel_capture_support(
experimental_multi_channel_capture_support) {}
multi_channel_render_support(multi_channel_render_support),
multi_channel_capture_support(multi_channel_capture_support) {}
int agc_startup_min_volume;
int agc_clipped_level_min;
bool use_experimental_agc;
bool use_experimental_agc_agc2_level_estimation;
bool use_experimental_agc_agc2_digital_adaptive;
bool experimental_multi_channel_render_support;
bool experimental_multi_channel_capture_support;
bool multi_channel_render_support;
bool multi_channel_capture_support;
} constants_;
struct ApmCaptureState {

View File

@ -75,8 +75,9 @@ std::string AudioProcessing::Config::ToString() const {
<< "pipeline: {"
<< "maximum_internal_processing_rate: "
<< pipeline.maximum_internal_processing_rate
<< ", experimental_multi_channel: "
<< pipeline.experimental_multi_channel << "}, "
<< ", 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
<< " }, high_pass_filter: { enabled: " << high_pass_filter.enabled

View File

@ -256,8 +256,14 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
// default rate is currently selected based on the CPU architecture, but
// that logic may change.
int maximum_internal_processing_rate;
// Force multi-channel processing on playout and capture audio. This is an
// experimental feature, and is likely to change without warning.
// Allow multi-channel processing of render audio.
bool multi_channel_render = false;
// Allow multi-channel processing of capture audio when AEC3 is active
// or a custom AEC is injected..
bool multi_channel_capture = false;
// Deprecated.
// TODO(peah): Remove.
bool experimental_multi_channel = false;
} pipeline;

View File

@ -403,9 +403,13 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
if (settings_.use_ts) {
config.Set<ExperimentalNs>(new ExperimentalNs(*settings_.use_ts));
}
if (settings_.experimental_multi_channel) {
apm_config.pipeline.experimental_multi_channel =
*settings_.experimental_multi_channel;
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_agc2) {

View File

@ -85,7 +85,8 @@ struct SimulationSettings {
absl::optional<bool> use_refined_adaptive_filter;
int initial_mic_level;
bool simulate_mic_gain = false;
absl::optional<bool> experimental_multi_channel;
absl::optional<bool> multi_channel_render;
absl::optional<bool> multi_channel_capture;
absl::optional<int> simulated_mic_kind;
bool report_performance = false;
absl::optional<std::string> performance_report_output_filename;

View File

@ -217,9 +217,15 @@ ABSL_FLAG(int,
0,
"Activate (1) or deactivate(0) the analog mic gain simulation");
ABSL_FLAG(int,
experimental_multi_channel,
multi_channel_render,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) multi-channel audio in APM pipeline");
"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,
@ -443,8 +449,10 @@ SimulationSettings CreateSettings() {
SetSettingIfSpecified(absl::GetFlag(FLAGS_aec_settings),
&settings.aec_settings_filename);
settings.initial_mic_level = absl::GetFlag(FLAGS_initial_mic_level);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_experimental_multi_channel),
&settings.experimental_multi_channel);
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);

View File

@ -122,7 +122,8 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
#endif
webrtc::AudioProcessing::Config apm_config;
apm_config.pipeline.experimental_multi_channel = true;
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.echo_canceller.mobile_mode = use_aecm;
apm_config.residual_echo_detector.enabled = red;