This CL adds the basic framework for AEC3 in the audio processing module.
It will be followed by a number of other CLs that extends this framework. BUG=webrtc:6018 Review-Url: https://codereview.webrtc.org/2567513003 Cr-Commit-Position: refs/heads/master@{#15593}
This commit is contained in:
@ -26,6 +26,8 @@ rtc_static_library("audio_processing") {
|
||||
"aec/aec_resampler.h",
|
||||
"aec/echo_cancellation.cc",
|
||||
"aec/echo_cancellation.h",
|
||||
"aec3/echo_canceller3.cc",
|
||||
"aec3/echo_canceller3.h",
|
||||
"aecm/aecm_core.cc",
|
||||
"aecm/aecm_core.h",
|
||||
"aecm/echo_control_mobile.cc",
|
||||
|
||||
@ -1500,7 +1500,6 @@ AecCore* WebRtcAec_CreateAec(int instance_count) {
|
||||
WebRtc_set_lookahead(aec->delay_estimator, kLookaheadBlocks);
|
||||
#endif
|
||||
aec->extended_filter_enabled = 0;
|
||||
aec->aec3_enabled = 0;
|
||||
aec->refined_adaptive_filter_enabled = false;
|
||||
|
||||
// Assembly optimization
|
||||
@ -2014,15 +2013,6 @@ int WebRtcAec_delay_agnostic_enabled(AecCore* self) {
|
||||
return self->delay_agnostic_enabled;
|
||||
}
|
||||
|
||||
void WebRtcAec_enable_aec3(AecCore* self, int enable) {
|
||||
self->aec3_enabled = (enable != 0);
|
||||
}
|
||||
|
||||
int WebRtcAec_aec3_enabled(AecCore* self) {
|
||||
RTC_DCHECK(self->aec3_enabled == 0 || self->aec3_enabled == 1);
|
||||
return self->aec3_enabled;
|
||||
}
|
||||
|
||||
void WebRtcAec_enable_refined_adaptive_filter(AecCore* self, bool enable) {
|
||||
self->refined_adaptive_filter_enabled = enable;
|
||||
SetAdaptiveFilterStepSize(self);
|
||||
|
||||
@ -239,8 +239,7 @@ struct AecCore {
|
||||
int delay_agnostic_enabled;
|
||||
// 1 = extended filter mode enabled, 0 = disabled.
|
||||
int extended_filter_enabled;
|
||||
// 1 = next generation aec mode enabled, 0 = disabled.
|
||||
int aec3_enabled;
|
||||
// 1 = refined filter adaptation aec mode enabled, 0 = disabled.
|
||||
bool refined_adaptive_filter_enabled;
|
||||
|
||||
// Runtime selection of number of filter partitions.
|
||||
@ -310,12 +309,6 @@ void WebRtcAec_enable_delay_agnostic(AecCore* self, int enable);
|
||||
// enabled and zero if disabled.
|
||||
int WebRtcAec_delay_agnostic_enabled(AecCore* self);
|
||||
|
||||
// Non-zero enables, zero disables.
|
||||
void WebRtcAec_enable_aec3(AecCore* self, int enable);
|
||||
|
||||
// Returns 1 if the next generation aec is enabled and zero if disabled.
|
||||
int WebRtcAec_aec3_enabled(AecCore* self);
|
||||
|
||||
// Turns on/off the refined adaptive filter feature.
|
||||
void WebRtcAec_enable_refined_adaptive_filter(AecCore* self, bool enable);
|
||||
|
||||
|
||||
57
webrtc/modules/audio_processing/aec3/echo_canceller3.cc
Normal file
57
webrtc/modules/audio_processing/aec3/echo_canceller3.cc
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "webrtc/modules/audio_processing/aec3/echo_canceller3.h"
|
||||
|
||||
#include "webrtc/base/atomicops.h"
|
||||
#include "webrtc/system_wrappers/include/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
int EchoCanceller3::instance_count_ = 0;
|
||||
|
||||
EchoCanceller3::EchoCanceller3(int sample_rate_hz, bool use_anti_hum_filter) {
|
||||
int band_sample_rate_hz = (sample_rate_hz == 8000 ? sample_rate_hz : 16000);
|
||||
frame_length_ = rtc::CheckedDivExact(band_sample_rate_hz, 100);
|
||||
|
||||
LOG(LS_INFO) << "AEC3 created : "
|
||||
<< "{ instance_count: " << instance_count_ << "}";
|
||||
instance_count_ = rtc::AtomicOps::Increment(&instance_count_);
|
||||
}
|
||||
|
||||
EchoCanceller3::~EchoCanceller3() = default;
|
||||
|
||||
bool EchoCanceller3::AnalyzeRender(AudioBuffer* render) {
|
||||
RTC_DCHECK_EQ(1u, render->num_channels());
|
||||
RTC_DCHECK_EQ(frame_length_, render->num_frames_per_band());
|
||||
return true;
|
||||
}
|
||||
|
||||
void EchoCanceller3::AnalyzeCapture(AudioBuffer* capture) {}
|
||||
|
||||
void EchoCanceller3::ProcessCapture(AudioBuffer* capture,
|
||||
bool known_echo_path_change) {
|
||||
RTC_DCHECK_EQ(1u, capture->num_channels());
|
||||
RTC_DCHECK_EQ(frame_length_, capture->num_frames_per_band());
|
||||
}
|
||||
|
||||
std::string EchoCanceller3::ToString(
|
||||
const AudioProcessing::Config::EchoCanceller3& config) {
|
||||
std::stringstream ss;
|
||||
ss << "{"
|
||||
<< "enabled: " << (config.enabled ? "true" : "false") << "}";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool EchoCanceller3::Validate(
|
||||
const AudioProcessing::Config::EchoCanceller3& config) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
48
webrtc/modules/audio_processing/aec3/echo_canceller3.h
Normal file
48
webrtc/modules/audio_processing/aec3/echo_canceller3.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_CANCELLER3_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_CANCELLER3_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class EchoCanceller3 {
|
||||
public:
|
||||
EchoCanceller3(int sample_rate_hz, bool use_anti_hum_filter);
|
||||
~EchoCanceller3();
|
||||
// Analyzes and stores an internal copy of the split-band domain render
|
||||
// signal.
|
||||
bool AnalyzeRender(AudioBuffer* farend);
|
||||
// Analyzes the full-band domain capture signal to detect signal saturation.
|
||||
void AnalyzeCapture(AudioBuffer* capture);
|
||||
// Processes the split-band domain capture signal in order to remove any echo
|
||||
// present in the signal.
|
||||
void ProcessCapture(AudioBuffer* capture, bool known_echo_path_change);
|
||||
|
||||
// Validates a config.
|
||||
static bool Validate(const AudioProcessing::Config::EchoCanceller3& config);
|
||||
// Dumps a config to a string.
|
||||
static std::string ToString(
|
||||
const AudioProcessing::Config::EchoCanceller3& config);
|
||||
|
||||
private:
|
||||
static int instance_count_;
|
||||
size_t frame_length_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoCanceller3);
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_CANCELLER3_H_
|
||||
@ -20,6 +20,7 @@
|
||||
#include "webrtc/common_audio/include/audio_util.h"
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/modules/audio_processing/aec/aec_core.h"
|
||||
#include "webrtc/modules/audio_processing/aec3/echo_canceller3.h"
|
||||
#include "webrtc/modules/audio_processing/agc/agc_manager_direct.h"
|
||||
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||
#include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h"
|
||||
@ -167,6 +168,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::Update(
|
||||
bool beamformer_enabled,
|
||||
bool adaptive_gain_controller_enabled,
|
||||
bool level_controller_enabled,
|
||||
bool echo_canceller3_enabled,
|
||||
bool voice_activity_detector_enabled,
|
||||
bool level_estimator_enabled,
|
||||
bool transient_suppressor_enabled) {
|
||||
@ -184,6 +186,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::Update(
|
||||
changed |=
|
||||
(adaptive_gain_controller_enabled != adaptive_gain_controller_enabled_);
|
||||
changed |= (level_controller_enabled != level_controller_enabled_);
|
||||
changed |= (echo_canceller3_enabled != echo_canceller3_enabled_);
|
||||
changed |= (level_estimator_enabled != level_estimator_enabled_);
|
||||
changed |=
|
||||
(voice_activity_detector_enabled != voice_activity_detector_enabled_);
|
||||
@ -198,6 +201,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::Update(
|
||||
beamformer_enabled_ = beamformer_enabled;
|
||||
adaptive_gain_controller_enabled_ = adaptive_gain_controller_enabled;
|
||||
level_controller_enabled_ = level_controller_enabled;
|
||||
echo_canceller3_enabled_ = echo_canceller3_enabled;
|
||||
level_estimator_enabled_ = level_estimator_enabled;
|
||||
voice_activity_detector_enabled_ = voice_activity_detector_enabled;
|
||||
transient_suppressor_enabled_ = transient_suppressor_enabled;
|
||||
@ -224,14 +228,15 @@ bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandProcessingActive()
|
||||
const {
|
||||
return low_cut_filter_enabled_ || echo_canceller_enabled_ ||
|
||||
mobile_echo_controller_enabled_ || noise_suppressor_enabled_ ||
|
||||
beamformer_enabled_ || adaptive_gain_controller_enabled_;
|
||||
beamformer_enabled_ || adaptive_gain_controller_enabled_ ||
|
||||
echo_canceller3_enabled_;
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandSubModulesActive()
|
||||
const {
|
||||
return RenderMultiBandProcessingActive() || echo_canceller_enabled_ ||
|
||||
mobile_echo_controller_enabled_ || adaptive_gain_controller_enabled_ ||
|
||||
residual_echo_detector_enabled_;
|
||||
residual_echo_detector_enabled_ || echo_canceller3_enabled_;
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandProcessingActive()
|
||||
@ -271,6 +276,7 @@ struct AudioProcessingImpl::ApmPrivateSubmodules {
|
||||
std::unique_ptr<LowCutFilter> low_cut_filter;
|
||||
std::unique_ptr<LevelController> level_controller;
|
||||
std::unique_ptr<ResidualEchoDetector> residual_echo_detector;
|
||||
std::unique_ptr<EchoCanceller3> echo_canceller3;
|
||||
};
|
||||
|
||||
AudioProcessing* AudioProcessing::Create() {
|
||||
@ -433,10 +439,18 @@ int AudioProcessingImpl::MaybeInitialize(
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::InitializeLocked() {
|
||||
const int capture_audiobuffer_num_channels =
|
||||
capture_nonlocked_.beamformer_enabled
|
||||
? formats_.api_format.input_stream().num_channels()
|
||||
: formats_.api_format.output_stream().num_channels();
|
||||
int capture_audiobuffer_num_channels;
|
||||
if (private_submodules_->echo_canceller3) {
|
||||
// TODO(peah): Ensure that the echo canceller can operate on more than one
|
||||
// microphone channel.
|
||||
RTC_DCHECK(!capture_nonlocked_.beamformer_enabled);
|
||||
capture_audiobuffer_num_channels = 1;
|
||||
} else {
|
||||
capture_audiobuffer_num_channels =
|
||||
capture_nonlocked_.beamformer_enabled
|
||||
? formats_.api_format.input_stream().num_channels()
|
||||
: formats_.api_format.output_stream().num_channels();
|
||||
}
|
||||
const int render_audiobuffer_num_output_frames =
|
||||
formats_.api_format.reverse_output_stream().num_frames() == 0
|
||||
? formats_.render_processing_format.num_frames()
|
||||
@ -508,6 +522,7 @@ int AudioProcessingImpl::InitializeLocked() {
|
||||
public_submodules_->level_estimator->Initialize();
|
||||
InitializeLevelController();
|
||||
InitializeResidualEchoDetector();
|
||||
InitializeEchoCanceller3();
|
||||
|
||||
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
||||
if (debug_dump_.debug_file->is_open()) {
|
||||
@ -561,7 +576,9 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) {
|
||||
submodule_states_.RenderMultiBandSubModulesActive());
|
||||
// TODO(aluebs): Remove this restriction once we figure out why the 3-band
|
||||
// splitting filter degrades the AEC performance.
|
||||
if (render_processing_rate > kSampleRate32kHz) {
|
||||
// TODO(peah): Verify that the band splitting is needed for the AEC3.
|
||||
if (render_processing_rate > kSampleRate32kHz &&
|
||||
!capture_nonlocked_.echo_canceller3_enabled) {
|
||||
render_processing_rate = submodule_states_.RenderMultiBandProcessingActive()
|
||||
? kSampleRate32kHz
|
||||
: kSampleRate16kHz;
|
||||
@ -629,6 +646,25 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
|
||||
|
||||
LOG(LS_INFO) << "Highpass filter activated: "
|
||||
<< config_.high_pass_filter.enabled;
|
||||
|
||||
config_ok = EchoCanceller3::Validate(config_.echo_canceller3);
|
||||
if (!config_ok) {
|
||||
LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl
|
||||
<< "echo canceller 3: "
|
||||
<< EchoCanceller3::ToString(config_.echo_canceller3)
|
||||
<< std::endl
|
||||
<< "Reverting to default parameter set";
|
||||
config_.echo_canceller3 = AudioProcessing::Config::EchoCanceller3();
|
||||
}
|
||||
|
||||
if (config.echo_canceller3.enabled !=
|
||||
capture_nonlocked_.echo_canceller3_enabled) {
|
||||
capture_nonlocked_.echo_canceller3_enabled =
|
||||
config_.echo_canceller3.enabled;
|
||||
InitializeEchoCanceller3();
|
||||
LOG(LS_INFO) << "Echo canceller 3 activated: "
|
||||
<< capture_nonlocked_.echo_canceller3_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) {
|
||||
@ -1108,6 +1144,10 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
levels.peak, 1, RmsLevel::kMinLevelDb, 64);
|
||||
}
|
||||
|
||||
if (private_submodules_->echo_canceller3) {
|
||||
private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer);
|
||||
}
|
||||
|
||||
if (constants_.use_experimental_agc &&
|
||||
public_submodules_->gain_control->is_enabled()) {
|
||||
private_submodules_->agc_manager->AnalyzePreProcess(
|
||||
@ -1128,7 +1168,9 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
capture_buffer->set_num_channels(1);
|
||||
}
|
||||
|
||||
if (private_submodules_->low_cut_filter) {
|
||||
// TODO(peah): Move the AEC3 low-cut filter to this place.
|
||||
if (private_submodules_->low_cut_filter &&
|
||||
!private_submodules_->echo_canceller3) {
|
||||
private_submodules_->low_cut_filter->Process(capture_buffer);
|
||||
}
|
||||
RETURN_ON_ERR(
|
||||
@ -1142,6 +1184,10 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
return AudioProcessing::kStreamParameterNotSetError;
|
||||
}
|
||||
|
||||
if (private_submodules_->echo_canceller3) {
|
||||
private_submodules_->echo_canceller3->ProcessCapture(capture_buffer, false);
|
||||
}
|
||||
|
||||
RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio(
|
||||
capture_buffer, stream_delay_ms()));
|
||||
|
||||
@ -1381,6 +1427,12 @@ int AudioProcessingImpl::ProcessRenderStreamLocked() {
|
||||
#endif
|
||||
|
||||
QueueRenderAudio(render_buffer);
|
||||
// TODO(peah): Perform the queueing ínside QueueRenderAudiuo().
|
||||
if (private_submodules_->echo_canceller3) {
|
||||
if (!private_submodules_->echo_canceller3->AnalyzeRender(render_buffer)) {
|
||||
// TODO(peah): Lock and empty render queue, and try again.
|
||||
}
|
||||
}
|
||||
|
||||
if (submodule_states_.RenderMultiBandProcessingActive() &&
|
||||
SampleRateSupportsMultiBand(
|
||||
@ -1604,6 +1656,7 @@ bool AudioProcessingImpl::UpdateActiveSubmoduleStates() {
|
||||
capture_nonlocked_.beamformer_enabled,
|
||||
public_submodules_->gain_control->is_enabled(),
|
||||
capture_nonlocked_.level_controller_enabled,
|
||||
capture_nonlocked_.echo_canceller3_enabled,
|
||||
public_submodules_->voice_detection->is_enabled(),
|
||||
public_submodules_->level_estimator->is_enabled(),
|
||||
capture_.transient_suppressor_enabled);
|
||||
@ -1652,6 +1705,14 @@ void AudioProcessingImpl::InitializeLowCutFilter() {
|
||||
private_submodules_->low_cut_filter.reset();
|
||||
}
|
||||
}
|
||||
void AudioProcessingImpl::InitializeEchoCanceller3() {
|
||||
if (capture_nonlocked_.echo_canceller3_enabled) {
|
||||
private_submodules_->echo_canceller3.reset(
|
||||
new EchoCanceller3(proc_sample_rate_hz(), true));
|
||||
} else {
|
||||
private_submodules_->echo_canceller3.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void AudioProcessingImpl::InitializeLevelController() {
|
||||
private_submodules_->level_controller->Initialize(proc_sample_rate_hz());
|
||||
@ -1857,6 +1918,9 @@ int AudioProcessingImpl::WriteConfigMessage(bool forced) {
|
||||
if (constants_.agc_clipped_level_min != kClippedLevelMin) {
|
||||
experiments_description += "AgcClippingLevelExperiment;";
|
||||
}
|
||||
if (capture_nonlocked_.echo_canceller3_enabled) {
|
||||
experiments_description += "EchoCanceller3;";
|
||||
}
|
||||
config.set_experiments_description(experiments_description);
|
||||
|
||||
std::string serialized_config = config.SerializeAsString();
|
||||
|
||||
@ -168,6 +168,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
bool beamformer_enabled,
|
||||
bool adaptive_gain_controller_enabled,
|
||||
bool level_controller_enabled,
|
||||
bool echo_canceller3_enabled,
|
||||
bool voice_activity_detector_enabled,
|
||||
bool level_estimator_enabled,
|
||||
bool transient_suppressor_enabled);
|
||||
@ -186,6 +187,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
bool beamformer_enabled_ = false;
|
||||
bool adaptive_gain_controller_enabled_ = false;
|
||||
bool level_controller_enabled_ = false;
|
||||
bool echo_canceller3_enabled_ = false;
|
||||
bool level_estimator_enabled_ = false;
|
||||
bool voice_activity_detector_enabled_ = false;
|
||||
bool transient_suppressor_enabled_ = false;
|
||||
@ -251,6 +253,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
void InitializeResidualEchoDetector()
|
||||
EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
|
||||
void InitializeLowCutFilter() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
|
||||
void InitializeEchoCanceller3() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
|
||||
|
||||
void EmptyQueuedRenderAudio();
|
||||
void AllocateRenderQueue()
|
||||
@ -382,6 +385,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
bool beamformer_enabled;
|
||||
bool intelligibility_enabled;
|
||||
bool level_controller_enabled = false;
|
||||
bool echo_canceller3_enabled = false;
|
||||
} capture_nonlocked_;
|
||||
|
||||
struct ApmRenderState {
|
||||
|
||||
@ -106,8 +106,7 @@ EchoCancellationImpl::EchoCancellationImpl(rtc::CriticalSection* crit_render,
|
||||
stream_has_echo_(false),
|
||||
delay_logging_enabled_(false),
|
||||
extended_filter_enabled_(false),
|
||||
delay_agnostic_enabled_(false),
|
||||
aec3_enabled_(false) {
|
||||
delay_agnostic_enabled_(false) {
|
||||
RTC_DCHECK(crit_render);
|
||||
RTC_DCHECK(crit_capture);
|
||||
}
|
||||
@ -341,18 +340,9 @@ bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
|
||||
return delay_agnostic_enabled_;
|
||||
}
|
||||
|
||||
bool EchoCancellationImpl::is_aec3_enabled() const {
|
||||
rtc::CritScope cs(crit_capture_);
|
||||
return aec3_enabled_;
|
||||
}
|
||||
|
||||
std::string EchoCancellationImpl::GetExperimentsDescription() {
|
||||
rtc::CritScope cs(crit_capture_);
|
||||
std::string description = (aec3_enabled_ ? "AEC3;" : "");
|
||||
if (refined_adaptive_filter_enabled_) {
|
||||
description += "RefinedAdaptiveFilter;";
|
||||
}
|
||||
return description;
|
||||
return refined_adaptive_filter_enabled_ ? "RefinedAdaptiveFilter;" : "";
|
||||
}
|
||||
|
||||
bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const {
|
||||
@ -473,7 +463,6 @@ void EchoCancellationImpl::SetExtraOptions(const webrtc::Config& config) {
|
||||
delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled;
|
||||
refined_adaptive_filter_enabled_ =
|
||||
config.Get<RefinedAdaptiveFilter>().enabled;
|
||||
aec3_enabled_ = config.Get<EchoCanceller3>().enabled;
|
||||
}
|
||||
Configure();
|
||||
}
|
||||
@ -493,8 +482,6 @@ int EchoCancellationImpl::Configure() {
|
||||
extended_filter_enabled_ ? 1 : 0);
|
||||
WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()),
|
||||
delay_agnostic_enabled_ ? 1 : 0);
|
||||
WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()),
|
||||
aec3_enabled_ ? 1 : 0);
|
||||
WebRtcAec_enable_refined_adaptive_filter(
|
||||
WebRtcAec_aec_core(canceller->state()),
|
||||
refined_adaptive_filter_enabled_);
|
||||
|
||||
@ -44,7 +44,6 @@ class EchoCancellationImpl : public EchoCancellation {
|
||||
void SetExtraOptions(const webrtc::Config& config);
|
||||
bool is_delay_agnostic_enabled() const;
|
||||
bool is_extended_filter_enabled() const;
|
||||
bool is_aec3_enabled() const;
|
||||
std::string GetExperimentsDescription();
|
||||
bool is_refined_adaptive_filter_enabled() const;
|
||||
|
||||
@ -104,7 +103,6 @@ class EchoCancellationImpl : public EchoCancellation {
|
||||
bool delay_logging_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool extended_filter_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool delay_agnostic_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool aec3_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool refined_adaptive_filter_enabled_ GUARDED_BY(crit_capture_) = false;
|
||||
|
||||
std::vector<std::unique_ptr<Canceller>> cancellers_;
|
||||
|
||||
@ -68,17 +68,6 @@ struct ExtendedFilter {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Enables the next generation AEC functionality. This feature replaces the
|
||||
// standard methods for echo removal in the AEC. This configuration only applies
|
||||
// to EchoCancellation and not EchoControlMobile. It can be set in the
|
||||
// constructor or using AudioProcessing::SetExtraOptions().
|
||||
struct EchoCanceller3 {
|
||||
EchoCanceller3() : enabled(false) {}
|
||||
explicit EchoCanceller3(bool enabled) : enabled(enabled) {}
|
||||
static const ConfigOptionID identifier = ConfigOptionID::kEchoCanceller3;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Enables the refined linear filter adaptation in the echo canceller.
|
||||
// This configuration only applies to EchoCancellation and not
|
||||
// EchoControlMobile. It can be set in the constructor
|
||||
@ -274,6 +263,14 @@ class AudioProcessing {
|
||||
struct HighPassFilter {
|
||||
bool enabled = false;
|
||||
} high_pass_filter;
|
||||
|
||||
// Enables the next generation AEC functionality. This feature replaces the
|
||||
// standard methods for echo removal in the AEC.
|
||||
// The functionality is not yet activated in the code and turning this on
|
||||
// does not yet have the desired behavior.
|
||||
struct EchoCanceller3 {
|
||||
bool enabled = false;
|
||||
} echo_canceller3;
|
||||
};
|
||||
|
||||
// TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone.
|
||||
|
||||
@ -24,16 +24,16 @@ enum class ConfigOptionID {
|
||||
kMyExperimentForTest,
|
||||
kAlgo1CostFunctionForTest,
|
||||
kTemporalLayersFactory, // Deprecated
|
||||
kNetEqCapacityConfig, // Deprecated
|
||||
kNetEqFastAccelerate, // Deprecated
|
||||
kVoicePacing, // Deprecated
|
||||
kNetEqCapacityConfig, // Deprecated
|
||||
kNetEqFastAccelerate, // Deprecated
|
||||
kVoicePacing, // Deprecated
|
||||
kExtendedFilter,
|
||||
kDelayAgnostic,
|
||||
kExperimentalAgc,
|
||||
kExperimentalNs,
|
||||
kBeamforming,
|
||||
kIntelligibility,
|
||||
kEchoCanceller3,
|
||||
kEchoCanceller3, // Deprecated
|
||||
kAecRefinedAdaptiveFilter,
|
||||
kLevelControl
|
||||
};
|
||||
|
||||
@ -491,7 +491,7 @@ void AecDumpBasedSimulator::HandleMessage(
|
||||
}
|
||||
|
||||
if (settings_.use_aec3) {
|
||||
config.Set<EchoCanceller3>(new EchoCanceller3(*settings_.use_aec3));
|
||||
apm_config.echo_canceller3.enabled = *settings_.use_aec3;
|
||||
}
|
||||
|
||||
if (settings_.use_lc) {
|
||||
|
||||
@ -268,7 +268,7 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
|
||||
config.Set<Intelligibility>(new Intelligibility(*settings_.use_ie));
|
||||
}
|
||||
if (settings_.use_aec3) {
|
||||
config.Set<EchoCanceller3>(new EchoCanceller3(*settings_.use_aec3));
|
||||
apm_config.echo_canceller3.enabled = *settings_.use_aec3;
|
||||
}
|
||||
if (settings_.use_lc) {
|
||||
apm_config.level_controller.enabled = *settings_.use_lc;
|
||||
|
||||
@ -377,11 +377,12 @@ TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) {
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
|
||||
config.Set<EchoCanceller3>(new EchoCanceller3(true));
|
||||
// Arbitrarily set clipping gain to 17, which will never be the default.
|
||||
config.Set<ExperimentalAgc>(new ExperimentalAgc(true, 0, 17));
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
apm_config.echo_canceller3.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -398,7 +399,7 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
|
||||
ASSERT_TRUE(msg->has_experiments_description());
|
||||
EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
|
||||
msg->experiments_description().c_str());
|
||||
EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3",
|
||||
EXPECT_PRED_FORMAT2(testing::IsSubstring, "EchoCanceller3",
|
||||
msg->experiments_description().c_str());
|
||||
EXPECT_PRED_FORMAT2(testing::IsSubstring, "AgcClippingLevelExperiment",
|
||||
msg->experiments_description().c_str());
|
||||
@ -436,8 +437,9 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
|
||||
Config config;
|
||||
config.Set<EchoCanceller3>(new EchoCanceller3(true));
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.echo_canceller3.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -452,7 +454,7 @@ 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::IsSubstring, "AEC3",
|
||||
EXPECT_PRED_FORMAT2(testing::IsSubstring, "EchoCanceller3",
|
||||
msg->experiments_description().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user