Separate AEC3 config from AudioProcessing::Config.

The struct containing the config for AEC3 is removed from
AudioProcessing::Config and is put in a new struct called
EchoCanceller3Config.

AEC3 should no longer be activated through
AudioProcessing::ApplyConfig. Instead an EchoCanceller3Factory
can be injected at AudioProcessing creation.

Bug: webrtc:8346
Change-Id: I27e3592e675eec3632a60c45d9e0d12514c2c567
Reviewed-on: https://webrtc-review.googlesource.com/11420
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20342}
This commit is contained in:
Gustaf Ullberg
2017-10-18 12:32:42 +02:00
committed by Commit Bot
parent 737e073f8d
commit bd83b914c3
36 changed files with 285 additions and 323 deletions

View File

@ -46,9 +46,14 @@ class DebugDumpGenerator {
int reverse_rate_hz,
int reverse_channels,
const Config& config,
const std::string& dump_file_name);
const std::string& dump_file_name,
bool enable_aec3);
// Constructor that uses default input files.
explicit DebugDumpGenerator(const Config& config,
const AudioProcessing::Config& apm_config,
bool enable_aec3);
explicit DebugDumpGenerator(const Config& config,
const AudioProcessing::Config& apm_config);
@ -118,7 +123,8 @@ DebugDumpGenerator::DebugDumpGenerator(const std::string& input_file_name,
int reverse_rate_hz,
int reverse_channels,
const Config& config,
const std::string& dump_file_name)
const std::string& dump_file_name,
bool enable_aec3)
: input_config_(input_rate_hz, input_channels),
reverse_config_(reverse_rate_hz, reverse_channels),
output_config_(input_rate_hz, input_channels),
@ -133,12 +139,19 @@ DebugDumpGenerator::DebugDumpGenerator(const std::string& input_file_name,
output_(new ChannelBuffer<float>(output_config_.num_frames(),
output_config_.num_channels())),
worker_queue_("debug_dump_generator_worker_queue"),
apm_(AudioProcessing::Create(config)),
apm_(AudioProcessing::Create(
config,
nullptr,
(enable_aec3 ? std::unique_ptr<EchoControlFactory>(
new EchoCanceller3Factory())
: nullptr),
nullptr)),
dump_file_name_(dump_file_name) {}
DebugDumpGenerator::DebugDumpGenerator(
const Config& config,
const AudioProcessing::Config& apm_config)
const AudioProcessing::Config& apm_config,
bool enable_aec3)
: DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"),
32000,
2,
@ -146,7 +159,15 @@ DebugDumpGenerator::DebugDumpGenerator(
32000,
2,
config,
TempFilename(OutputPath(), "debug_aec")) {
TempFilename(OutputPath(), "debug_aec"),
enable_aec3) {
apm_->ApplyConfig(apm_config);
}
DebugDumpGenerator::DebugDumpGenerator(
const Config& config,
const AudioProcessing::Config& apm_config)
: DebugDumpGenerator(config, apm_config, false) {
apm_->ApplyConfig(apm_config);
}
@ -384,8 +405,8 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
// Arbitrarily set clipping gain to 17, which will never be the default.
config.Set<ExperimentalAgc>(new ExperimentalAgc(true, 0, 17));
apm_config.echo_canceller3.enabled = true;
DebugDumpGenerator generator(config, apm_config);
bool enable_aec3 = true;
DebugDumpGenerator generator(config, apm_config, enable_aec3);
generator.StartRecording();
generator.Process(100);
generator.StopRecording();
@ -441,8 +462,7 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
Config config;
AudioProcessing::Config apm_config;
apm_config.echo_canceller3.enabled = true;
DebugDumpGenerator generator(config, apm_config);
DebugDumpGenerator generator(config, apm_config, true);
generator.StartRecording();
generator.Process(100);
generator.StopRecording();