Remove deprecated legacy AEC code

This CL removes the deprecated legacy AEC code.

Note that this CL should not be landed before the M80 release has been cut.

Bug: webrtc:11165
Change-Id: I59ee94526e62f702bb9fa9fa2d38c4e48f44753c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161238
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30036}
This commit is contained in:
Per Åhgren
2019-12-09 10:18:44 +01:00
committed by Commit Bot
parent 5b030cabcc
commit 62ea0aaea0
38 changed files with 31 additions and 8261 deletions

View File

@ -13,7 +13,6 @@
#include <iostream>
#include <memory>
#include "modules/audio_processing/echo_cancellation_impl.h"
#include "modules/audio_processing/echo_control_mobile_impl.h"
#include "modules/audio_processing/test/protobuf_utils.h"
#include "rtc_base/checks.h"
@ -300,57 +299,6 @@ void AecDumpBasedSimulator::HandleMessage(
}
}
if (msg.has_aec_delay_agnostic_enabled() || settings_.use_delay_agnostic) {
bool enable = settings_.use_delay_agnostic
? *settings_.use_delay_agnostic
: msg.aec_delay_agnostic_enabled();
config.Set<DelayAgnostic>(new DelayAgnostic(enable));
if (settings_.use_verbose_logging) {
std::cout << " aec_delay_agnostic_enabled: "
<< (enable ? "true" : "false") << std::endl;
}
}
if (msg.has_aec_drift_compensation_enabled() ||
settings_.use_drift_compensation) {
if (settings_.use_drift_compensation
? *settings_.use_drift_compensation
: msg.aec_drift_compensation_enabled()) {
RTC_LOG(LS_ERROR)
<< "Ignoring deprecated setting: AEC2 drift compensation";
}
}
if (msg.has_aec_extended_filter_enabled() ||
settings_.use_extended_filter) {
bool enable = settings_.use_extended_filter
? *settings_.use_extended_filter
: msg.aec_extended_filter_enabled();
config.Set<ExtendedFilter>(new ExtendedFilter(enable));
if (settings_.use_verbose_logging) {
std::cout << " aec_extended_filter_enabled: "
<< (enable ? "true" : "false") << std::endl;
}
}
if (msg.has_aec_suppression_level() || settings_.aec_suppression_level) {
auto level = static_cast<webrtc::EchoCancellationImpl::SuppressionLevel>(
settings_.aec_suppression_level ? *settings_.aec_suppression_level
: msg.aec_suppression_level());
if (level ==
webrtc::EchoCancellationImpl::SuppressionLevel::kLowSuppression) {
RTC_LOG(LS_ERROR)
<< "Ignoring deprecated setting: AEC2 low suppression";
} else {
apm_config.echo_canceller.legacy_moderate_suppression_level =
(level == webrtc::EchoCancellationImpl::SuppressionLevel::
kModerateSuppression);
if (settings_.use_verbose_logging) {
std::cout << " aec_suppression_level: " << level << std::endl;
}
}
}
if (msg.has_aecm_enabled() || settings_.use_aecm) {
bool enable =
settings_.use_aecm ? *settings_.use_aecm : msg.aecm_enabled();
@ -486,11 +434,6 @@ void AecDumpBasedSimulator::HandleMessage(
<< msg.experiments_description() << std::endl;
}
if (settings_.use_refined_adaptive_filter) {
config.Set<RefinedAdaptiveFilter>(
new RefinedAdaptiveFilter(*settings_.use_refined_adaptive_filter));
}
if (settings_.use_ed) {
apm_config.residual_echo_detector.enabled = *settings_.use_ed;
}

View File

@ -22,7 +22,6 @@
#include "api/audio/echo_canceller3_factory.h"
#include "common_audio/include/audio_util.h"
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
#include "modules/audio_processing/echo_cancellation_impl.h"
#include "modules/audio_processing/echo_control_mobile_impl.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
@ -433,23 +432,17 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
}
}
const bool use_legacy_aec = settings_.use_aec && *settings_.use_aec &&
settings_.use_legacy_aec &&
*settings_.use_legacy_aec;
const bool use_aec = settings_.use_aec && *settings_.use_aec;
const bool use_aecm = settings_.use_aecm && *settings_.use_aecm;
if (use_legacy_aec || use_aec || use_aecm) {
if (use_aec || use_aecm) {
apm_config.echo_canceller.enabled = true;
apm_config.echo_canceller.mobile_mode = use_aecm;
apm_config.echo_canceller.use_legacy_aec = use_legacy_aec;
apm_config.echo_canceller.use_legacy_aec = false;
}
apm_config.echo_canceller.export_linear_aec_output =
!!settings_.linear_aec_output_filename;
RTC_CHECK(!(use_legacy_aec && settings_.aec_settings_filename))
<< "The legacy AEC cannot be configured using settings";
if (use_aec && !use_legacy_aec) {
if (use_aec) {
EchoCanceller3Config cfg;
if (settings_.aec_settings_filename) {
if (settings_.use_verbose_logging) {
@ -472,22 +465,6 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
}
}
if (settings_.use_drift_compensation && *settings_.use_drift_compensation) {
RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AEC2 drift compensation";
}
if (settings_.aec_suppression_level) {
auto level = static_cast<webrtc::EchoCancellationImpl::SuppressionLevel>(
*settings_.aec_suppression_level);
if (level ==
webrtc::EchoCancellationImpl::SuppressionLevel::kLowSuppression) {
RTC_LOG(LS_ERROR) << "Ignoring deprecated setting: AEC2 low suppression";
} else {
apm_config.echo_canceller.legacy_moderate_suppression_level =
(level == webrtc::EchoCancellationImpl::SuppressionLevel::
kModerateSuppression);
}
}
if (settings_.use_hpf) {
apm_config.high_pass_filter.enabled = *settings_.use_hpf;
}
@ -519,14 +496,6 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
*settings_.agc_compression_gain;
}
if (settings_.use_refined_adaptive_filter) {
config.Set<RefinedAdaptiveFilter>(
new RefinedAdaptiveFilter(*settings_.use_refined_adaptive_filter));
}
config.Set<ExtendedFilter>(new ExtendedFilter(
!settings_.use_extended_filter || *settings_.use_extended_filter));
config.Set<DelayAgnostic>(new DelayAgnostic(!settings_.use_delay_agnostic ||
*settings_.use_delay_agnostic));
config.Set<ExperimentalAgc>(new ExperimentalAgc(
!settings_.use_experimental_agc || *settings_.use_experimental_agc,
!!settings_.use_experimental_agc_agc2_level_estimator &&

View File

@ -37,7 +37,6 @@ struct SimulationSettings {
~SimulationSettings();
absl::optional<int> stream_delay;
absl::optional<bool> use_stream_delay;
absl::optional<int> stream_drift_samples;
absl::optional<int> output_sample_rate_hz;
absl::optional<int> output_num_channels;
absl::optional<int> reverse_output_sample_rate_hz;
@ -61,11 +60,6 @@ struct SimulationSettings {
absl::optional<bool> use_vad;
absl::optional<bool> use_le;
absl::optional<bool> use_all;
absl::optional<int> aec_suppression_level;
absl::optional<bool> use_delay_agnostic;
absl::optional<bool> use_extended_filter;
absl::optional<bool> use_drift_compensation;
absl::optional<bool> use_legacy_aec;
absl::optional<bool> use_legacy_ns;
absl::optional<bool> use_experimental_agc;
absl::optional<bool> use_experimental_agc_agc2_level_estimator;
@ -82,7 +76,6 @@ struct SimulationSettings {
absl::optional<float> pre_amplifier_gain_factor;
absl::optional<int> ns_level;
absl::optional<int> maximum_internal_processing_rate;
absl::optional<bool> use_refined_adaptive_filter;
int initial_mic_level;
bool simulate_mic_gain = false;
absl::optional<bool> multi_channel_render;

View File

@ -114,26 +114,10 @@ ABSL_FLAG(bool,
false,
"Activate all of the default components (will be overridden by any "
"other settings)");
ABSL_FLAG(int,
aec_suppression_level,
kParameterNotSpecifiedValue,
"Set the aec suppression level (0-2)");
ABSL_FLAG(int,
delay_agnostic,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AEC delay agnostic mode");
ABSL_FLAG(int,
extended_filter,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AEC extended filter mode");
ABSL_FLAG(int,
use_legacy_aec,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the legacy AEC");
ABSL_FLAG(int,
use_legacy_ns,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the legacy AEC");
"Activate (1) or deactivate(0) the legacy NS");
ABSL_FLAG(int,
experimental_agc,
kParameterNotSpecifiedValue,
@ -153,11 +137,6 @@ ABSL_FLAG(int,
kParameterNotSpecifiedValue,
"AGC2 level estimation"
" in the experimental AGC. AGC1 level estimation is the default (0)");
ABSL_FLAG(
int,
refined_adaptive_filter,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the refined adaptive filter functionality");
ABSL_FLAG(int,
agc_mode,
kParameterNotSpecifiedValue,
@ -395,17 +374,6 @@ SimulationSettings CreateSettings() {
SetSettingIfFlagSet(absl::GetFlag(FLAGS_ts), &settings.use_ts);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_vad), &settings.use_vad);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_le), &settings.use_le);
SetSettingIfSpecified(absl::GetFlag(FLAGS_aec_suppression_level),
&settings.aec_suppression_level);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_delay_agnostic),
&settings.use_delay_agnostic);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_extended_filter),
&settings.use_extended_filter);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_refined_adaptive_filter),
&settings.use_refined_adaptive_filter);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_use_legacy_aec),
&settings.use_legacy_aec);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_use_legacy_ns),
&settings.use_legacy_ns);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_experimental_agc),
@ -440,8 +408,6 @@ SimulationSettings CreateSettings() {
&settings.stream_delay);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_use_stream_delay),
&settings.use_stream_delay);
SetSettingIfSpecified(absl::GetFlag(FLAGS_stream_drift_samples),
&settings.stream_drift_samples);
SetSettingIfSpecified(absl::GetFlag(FLAGS_custom_call_order_file),
&settings.call_order_input_filename);
SetSettingIfSpecified(absl::GetFlag(FLAGS_output_custom_call_order_file),
@ -524,14 +490,6 @@ void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
"Error: The linear AEC ouput filename cannot "
"be specified without the AEC being active");
ReportConditionalErrorAndExit(
((settings.use_aec && *settings.use_aec && settings.use_legacy_aec &&
*settings.use_legacy_aec) ||
(settings.use_aecm && *settings.use_aecm)) &&
!!settings.linear_aec_output_filename,
"Error: The linear AEC ouput filename cannot be specified when the "
"legacy AEC or the AECm are used");
ReportConditionalErrorAndExit(
settings.use_aec && *settings.use_aec && settings.use_aecm &&
*settings.use_aecm,
@ -556,13 +514,6 @@ void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
*settings.reverse_output_num_channels <= 0,
"Error: --reverse_output_num_channels must be positive!\n");
ReportConditionalErrorAndExit(settings.aec_suppression_level &&
((*settings.aec_suppression_level) < 1 ||
(*settings.aec_suppression_level) > 2),
"Error: --aec_suppression_level must be "
"specified between 1 and 2. 0 is "
"deprecated.\n");
ReportConditionalErrorAndExit(
settings.agc_target_level && ((*settings.agc_target_level) < 0 ||
(*settings.agc_target_level) > 31),

View File

@ -10,7 +10,6 @@
#include "modules/audio_processing/test/debug_dump_replayer.h"
#include "modules/audio_processing/echo_cancellation_impl.h"
#include "modules/audio_processing/test/protobuf_utils.h"
#include "modules/audio_processing/test/runtime_setting_util.h"
#include "rtc_base/checks.h"
@ -181,8 +180,6 @@ void DebugDumpReplayer::MaybeRecreateApm(const audioproc::Config& msg) {
// These configurations cannot be changed on the fly.
Config config;
RTC_CHECK(msg.has_aec_delay_agnostic_enabled());
config.Set<DelayAgnostic>(
new DelayAgnostic(msg.aec_delay_agnostic_enabled()));
RTC_CHECK(msg.has_noise_robust_agc_enabled());
config.Set<ExperimentalAgc>(
@ -193,8 +190,6 @@ void DebugDumpReplayer::MaybeRecreateApm(const audioproc::Config& msg) {
new ExperimentalNs(msg.transient_suppression_enabled()));
RTC_CHECK(msg.has_aec_extended_filter_enabled());
config.Set<ExtendedFilter>(
new ExtendedFilter(msg.aec_extended_filter_enabled()));
// We only create APM once, since changes on these fields should not
// happen in current implementation.
@ -212,12 +207,6 @@ void DebugDumpReplayer::ConfigureApm(const audioproc::Config& msg) {
apm_config.echo_canceller.enabled = msg.aec_enabled() || msg.aecm_enabled();
apm_config.echo_canceller.mobile_mode = msg.aecm_enabled();
RTC_CHECK(msg.has_aec_suppression_level());
apm_config.echo_canceller.legacy_moderate_suppression_level =
static_cast<EchoCancellationImpl::SuppressionLevel>(
msg.aec_suppression_level()) ==
EchoCancellationImpl::SuppressionLevel::kModerateSuppression;
// HPF configs.
RTC_CHECK(msg.has_hpf_enabled());
apm_config.high_pass_filter.enabled = msg.hpf_enabled();

View File

@ -354,35 +354,6 @@ TEST_F(DebugDumpTest, ToggleAec) {
VerifyDebugDump(generator.dump_file_name());
}
TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) {
Config config;
AudioProcessing::Config apm_config;
apm_config.echo_canceller.enabled = true;
apm_config.echo_canceller.use_legacy_aec = true;
config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
DebugDumpGenerator generator(config, apm_config);
generator.StartRecording();
generator.Process(100);
generator.StopRecording();
DebugDumpReplayer debug_dump_replayer_;
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
const audioproc::Config* msg = &event->config();
ASSERT_TRUE(msg->has_experiments_description());
EXPECT_PRED_FORMAT2(::testing::IsSubstring, "RefinedAdaptiveFilter",
msg->experiments_description().c_str());
EXPECT_PRED_FORMAT2(::testing::IsSubstring, "Legacy AEC",
msg->experiments_description().c_str());
}
}
}
TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
Config config;
AudioProcessing::Config apm_config;
@ -406,8 +377,6 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
ASSERT_TRUE(msg->has_experiments_description());
EXPECT_PRED_FORMAT2(::testing::IsSubstring, "EchoController",
msg->experiments_description().c_str());
EXPECT_PRED_FORMAT2(::testing::IsNotSubstring, "Legacy AEC",
msg->experiments_description().c_str());
EXPECT_PRED_FORMAT2(::testing::IsSubstring, "AgcClippingLevelExperiment",
msg->experiments_description().c_str());
}
@ -418,7 +387,6 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
Config config;
AudioProcessing::Config apm_config;
apm_config.echo_canceller.enabled = true;
apm_config.echo_canceller.use_legacy_aec = true;
DebugDumpGenerator generator(config, apm_config);
generator.StartRecording();
generator.Process(100);
@ -434,8 +402,6 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
if (event->type() == audioproc::Event::CONFIG) {
const audioproc::Config* msg = &event->config();
ASSERT_TRUE(msg->has_experiments_description());
EXPECT_PRED_FORMAT2(::testing::IsNotSubstring, "EchoController",
msg->experiments_description().c_str());
EXPECT_PRED_FORMAT2(::testing::IsNotSubstring,
"AgcClippingLevelExperiment",
msg->experiments_description().c_str());
@ -462,8 +428,6 @@ TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
if (event->type() == audioproc::Event::CONFIG) {
const audioproc::Config* msg = &event->config();
ASSERT_TRUE(msg->has_experiments_description());
EXPECT_PRED_FORMAT2(::testing::IsNotSubstring, "Legacy AEC",
msg->experiments_description().c_str());
EXPECT_PRED_FORMAT2(::testing::IsSubstring, "EchoController",
msg->experiments_description().c_str());
}