Remove the enable flag from AEC2 and AECM
This CL removes the redundant enable flags from AEC2 and AECM Bug: webrtc:5298 Change-Id: Icc575abf1c368dda02ca77f057d166f1c921f662 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135100 Commit-Queue: Per Åhgren <peah@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27848}
This commit is contained in:
@ -1765,10 +1765,8 @@ AudioProcessing::Config AudioProcessingImpl::GetConfig() const {
|
|||||||
bool AudioProcessingImpl::UpdateActiveSubmoduleStates() {
|
bool AudioProcessingImpl::UpdateActiveSubmoduleStates() {
|
||||||
return submodule_states_.Update(
|
return submodule_states_.Update(
|
||||||
config_.high_pass_filter.enabled,
|
config_.high_pass_filter.enabled,
|
||||||
private_submodules_->echo_cancellation &&
|
!!private_submodules_->echo_cancellation,
|
||||||
private_submodules_->echo_cancellation->is_enabled(),
|
!!private_submodules_->echo_control_mobile,
|
||||||
private_submodules_->echo_control_mobile &&
|
|
||||||
private_submodules_->echo_control_mobile->is_enabled(),
|
|
||||||
config_.residual_echo_detector.enabled,
|
config_.residual_echo_detector.enabled,
|
||||||
public_submodules_->noise_suppression->is_enabled(),
|
public_submodules_->noise_suppression->is_enabled(),
|
||||||
public_submodules_->gain_control->is_enabled(),
|
public_submodules_->gain_control->is_enabled(),
|
||||||
@ -1860,8 +1858,6 @@ void AudioProcessingImpl::InitializeEchoController() {
|
|||||||
proc_split_sample_rate_hz(), num_reverse_channels(),
|
proc_split_sample_rate_hz(), num_reverse_channels(),
|
||||||
num_output_channels());
|
num_output_channels());
|
||||||
|
|
||||||
private_submodules_->echo_control_mobile->Enable(true);
|
|
||||||
|
|
||||||
private_submodules_->echo_cancellation.reset();
|
private_submodules_->echo_cancellation.reset();
|
||||||
aec_render_signal_queue_.reset();
|
aec_render_signal_queue_.reset();
|
||||||
return;
|
return;
|
||||||
@ -1897,8 +1893,6 @@ void AudioProcessingImpl::InitializeEchoController() {
|
|||||||
proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(),
|
proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(),
|
||||||
num_proc_channels());
|
num_proc_channels());
|
||||||
|
|
||||||
private_submodules_->echo_cancellation->Enable(true);
|
|
||||||
|
|
||||||
private_submodules_->echo_cancellation->set_suppression_level(
|
private_submodules_->echo_cancellation->set_suppression_level(
|
||||||
config_.echo_canceller.legacy_moderate_suppression_level
|
config_.echo_canceller.legacy_moderate_suppression_level
|
||||||
? EchoCancellationImpl::SuppressionLevel::kModerateSuppression
|
? EchoCancellationImpl::SuppressionLevel::kModerateSuppression
|
||||||
@ -1991,9 +1985,7 @@ void AudioProcessingImpl::WriteAecDumpConfigMessage(bool forced) {
|
|||||||
private_submodules_->echo_cancellation->suppression_level())
|
private_submodules_->echo_cancellation->suppression_level())
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
apm_config.aecm_enabled =
|
apm_config.aecm_enabled = !!private_submodules_->echo_control_mobile;
|
||||||
private_submodules_->echo_control_mobile &&
|
|
||||||
private_submodules_->echo_control_mobile->is_enabled();
|
|
||||||
apm_config.aecm_comfort_noise_enabled =
|
apm_config.aecm_comfort_noise_enabled =
|
||||||
private_submodules_->echo_control_mobile &&
|
private_submodules_->echo_control_mobile &&
|
||||||
private_submodules_->echo_control_mobile->is_comfort_noise_enabled();
|
private_submodules_->echo_control_mobile->is_comfort_noise_enabled();
|
||||||
|
@ -26,7 +26,6 @@ void SetupComponent(int sample_rate_hz,
|
|||||||
bool drift_compensation_enabled,
|
bool drift_compensation_enabled,
|
||||||
EchoCancellationImpl* echo_canceller) {
|
EchoCancellationImpl* echo_canceller) {
|
||||||
echo_canceller->Initialize(sample_rate_hz, 1, 1, 1);
|
echo_canceller->Initialize(sample_rate_hz, 1, 1, 1);
|
||||||
echo_canceller->Enable(true);
|
|
||||||
echo_canceller->set_suppression_level(suppression_level);
|
echo_canceller->set_suppression_level(suppression_level);
|
||||||
echo_canceller->enable_drift_compensation(drift_compensation_enabled);
|
echo_canceller->enable_drift_compensation(drift_compensation_enabled);
|
||||||
|
|
||||||
|
@ -120,10 +120,6 @@ EchoCancellationImpl::~EchoCancellationImpl() = default;
|
|||||||
|
|
||||||
void EchoCancellationImpl::ProcessRenderAudio(
|
void EchoCancellationImpl::ProcessRenderAudio(
|
||||||
rtc::ArrayView<const float> packed_render_audio) {
|
rtc::ArrayView<const float> packed_render_audio) {
|
||||||
if (!enabled_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RTC_DCHECK(stream_properties_);
|
RTC_DCHECK(stream_properties_);
|
||||||
size_t handle_index = 0;
|
size_t handle_index = 0;
|
||||||
size_t buffer_index = 0;
|
size_t buffer_index = 0;
|
||||||
@ -143,10 +139,6 @@ void EchoCancellationImpl::ProcessRenderAudio(
|
|||||||
|
|
||||||
int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
||||||
int stream_delay_ms) {
|
int stream_delay_ms) {
|
||||||
if (!enabled_) {
|
|
||||||
return AudioProcessing::kNoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int stream_delay_ms_use =
|
const int stream_delay_ms_use =
|
||||||
enforce_zero_stream_delay_ ? 0 : stream_delay_ms;
|
enforce_zero_stream_delay_ ? 0 : stream_delay_ms;
|
||||||
|
|
||||||
@ -198,27 +190,6 @@ int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
|||||||
return AudioProcessing::kNoError;
|
return AudioProcessing::kNoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EchoCancellationImpl::Enable(bool enable) {
|
|
||||||
if (enable && !enabled_) {
|
|
||||||
enabled_ = enable; // Must be set before Initialize() is called.
|
|
||||||
|
|
||||||
// TODO(peah): Simplify once the Enable function has been removed from
|
|
||||||
// the public APM API.
|
|
||||||
RTC_DCHECK(stream_properties_);
|
|
||||||
Initialize(stream_properties_->sample_rate_hz,
|
|
||||||
stream_properties_->num_reverse_channels,
|
|
||||||
stream_properties_->num_output_channels,
|
|
||||||
stream_properties_->num_proc_channels);
|
|
||||||
} else {
|
|
||||||
enabled_ = enable;
|
|
||||||
}
|
|
||||||
return AudioProcessing::kNoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EchoCancellationImpl::is_enabled() const {
|
|
||||||
return enabled_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EchoCancellationImpl::set_suppression_level(SuppressionLevel level) {
|
int EchoCancellationImpl::set_suppression_level(SuppressionLevel level) {
|
||||||
if (MapSetting(level) == -1) {
|
if (MapSetting(level) == -1) {
|
||||||
return AudioProcessing::kBadParameterError;
|
return AudioProcessing::kBadParameterError;
|
||||||
@ -256,7 +227,7 @@ int EchoCancellationImpl::enable_metrics(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EchoCancellationImpl::are_metrics_enabled() const {
|
bool EchoCancellationImpl::are_metrics_enabled() const {
|
||||||
return enabled_ && metrics_enabled_;
|
return metrics_enabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ajm): we currently just use the metrics from the first AEC. Think more
|
// TODO(ajm): we currently just use the metrics from the first AEC. Think more
|
||||||
@ -266,7 +237,7 @@ int EchoCancellationImpl::GetMetrics(Metrics* metrics) {
|
|||||||
return AudioProcessing::kNullPointerError;
|
return AudioProcessing::kNullPointerError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enabled_ || !metrics_enabled_) {
|
if (!metrics_enabled_) {
|
||||||
return AudioProcessing::kNotEnabledError;
|
return AudioProcessing::kNotEnabledError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +284,7 @@ int EchoCancellationImpl::enable_delay_logging(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EchoCancellationImpl::is_delay_logging_enabled() const {
|
bool EchoCancellationImpl::is_delay_logging_enabled() const {
|
||||||
return enabled_ && delay_logging_enabled_;
|
return delay_logging_enabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
|
bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
|
||||||
@ -321,13 +292,9 @@ bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string EchoCancellationImpl::GetExperimentsDescription() {
|
std::string EchoCancellationImpl::GetExperimentsDescription() {
|
||||||
if (enabled_) {
|
return refined_adaptive_filter_enabled_ ? "Legacy AEC;RefinedAdaptiveFilter;"
|
||||||
return refined_adaptive_filter_enabled_
|
|
||||||
? "Legacy AEC;RefinedAdaptiveFilter;"
|
|
||||||
: "Legacy AEC;";
|
: "Legacy AEC;";
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const {
|
bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const {
|
||||||
return refined_adaptive_filter_enabled_;
|
return refined_adaptive_filter_enabled_;
|
||||||
@ -353,7 +320,7 @@ int EchoCancellationImpl::GetDelayMetrics(int* median,
|
|||||||
return AudioProcessing::kNullPointerError;
|
return AudioProcessing::kNullPointerError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enabled_ || !delay_logging_enabled_) {
|
if (!delay_logging_enabled_) {
|
||||||
return AudioProcessing::kNotEnabledError;
|
return AudioProcessing::kNotEnabledError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,9 +334,6 @@ int EchoCancellationImpl::GetDelayMetrics(int* median,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct AecCore* EchoCancellationImpl::aec_core() const {
|
struct AecCore* EchoCancellationImpl::aec_core() const {
|
||||||
if (!enabled_) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return WebRtcAec_aec_core(cancellers_[0]->state());
|
return WebRtcAec_aec_core(cancellers_[0]->state());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,10 +345,6 @@ void EchoCancellationImpl::Initialize(int sample_rate_hz,
|
|||||||
new StreamProperties(sample_rate_hz, num_reverse_channels,
|
new StreamProperties(sample_rate_hz, num_reverse_channels,
|
||||||
num_output_channels, num_proc_channels));
|
num_output_channels, num_proc_channels));
|
||||||
|
|
||||||
if (!enabled_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t num_cancellers_required =
|
const size_t num_cancellers_required =
|
||||||
NumCancellersRequired(stream_properties_->num_output_channels,
|
NumCancellersRequired(stream_properties_->num_output_channels,
|
||||||
stream_properties_->num_reverse_channels);
|
stream_properties_->num_reverse_channels);
|
||||||
@ -405,7 +365,6 @@ void EchoCancellationImpl::Initialize(int sample_rate_hz,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int EchoCancellationImpl::GetSystemDelayInSamples() const {
|
int EchoCancellationImpl::GetSystemDelayInSamples() const {
|
||||||
RTC_DCHECK(enabled_);
|
|
||||||
// Report the delay for the first AEC component.
|
// Report the delay for the first AEC component.
|
||||||
return WebRtcAec_system_delay(WebRtcAec_aec_core(cancellers_[0]->state()));
|
return WebRtcAec_system_delay(WebRtcAec_aec_core(cancellers_[0]->state()));
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ class EchoCancellationImpl {
|
|||||||
void ProcessRenderAudio(rtc::ArrayView<const float> packed_render_audio);
|
void ProcessRenderAudio(rtc::ArrayView<const float> packed_render_audio);
|
||||||
int ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms);
|
int ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms);
|
||||||
|
|
||||||
int Enable(bool enable);
|
|
||||||
bool is_enabled() const;
|
|
||||||
|
|
||||||
// Differences in clock speed on the primary and reverse streams can impact
|
// Differences in clock speed on the primary and reverse streams can impact
|
||||||
// the AEC performance. On the client-side, this could be seen when different
|
// the AEC performance. On the client-side, this could be seen when different
|
||||||
@ -158,7 +156,6 @@ class EchoCancellationImpl {
|
|||||||
void AllocateRenderQueue();
|
void AllocateRenderQueue();
|
||||||
int Configure();
|
int Configure();
|
||||||
|
|
||||||
bool enabled_ = false;
|
|
||||||
bool drift_compensation_enabled_;
|
bool drift_compensation_enabled_;
|
||||||
bool metrics_enabled_;
|
bool metrics_enabled_;
|
||||||
SuppressionLevel suppression_level_;
|
SuppressionLevel suppression_level_;
|
||||||
|
@ -21,10 +21,6 @@ TEST(EchoCancellationInternalTest, ExtendedFilter) {
|
|||||||
EchoCancellationImpl echo_canceller;
|
EchoCancellationImpl echo_canceller;
|
||||||
echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 2, 2, 2);
|
echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 2, 2, 2);
|
||||||
|
|
||||||
EXPECT_TRUE(echo_canceller.aec_core() == nullptr);
|
|
||||||
|
|
||||||
echo_canceller.Enable(true);
|
|
||||||
|
|
||||||
AecCore* aec_core = echo_canceller.aec_core();
|
AecCore* aec_core = echo_canceller.aec_core();
|
||||||
ASSERT_TRUE(aec_core != NULL);
|
ASSERT_TRUE(aec_core != NULL);
|
||||||
// Disabled by default.
|
// Disabled by default.
|
||||||
@ -50,11 +46,6 @@ TEST(EchoCancellationInternalTest, DelayAgnostic) {
|
|||||||
EchoCancellationImpl echo_canceller;
|
EchoCancellationImpl echo_canceller;
|
||||||
echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 1, 1, 1);
|
echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 1, 1, 1);
|
||||||
|
|
||||||
EXPECT_TRUE(echo_canceller.aec_core() == NULL);
|
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(true));
|
|
||||||
EXPECT_TRUE(echo_canceller.is_enabled());
|
|
||||||
|
|
||||||
AecCore* aec_core = echo_canceller.aec_core();
|
AecCore* aec_core = echo_canceller.aec_core();
|
||||||
ASSERT_TRUE(aec_core != NULL);
|
ASSERT_TRUE(aec_core != NULL);
|
||||||
// Enabled by default.
|
// Enabled by default.
|
||||||
@ -97,12 +88,6 @@ TEST(EchoCancellationInternalTest, InterfaceConfiguration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EchoCancellationImpl::Metrics metrics;
|
EchoCancellationImpl::Metrics metrics;
|
||||||
EXPECT_EQ(AudioProcessing::kNotEnabledError,
|
|
||||||
echo_canceller.GetMetrics(&metrics));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(true));
|
|
||||||
EXPECT_TRUE(echo_canceller.is_enabled());
|
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.enable_metrics(true));
|
EXPECT_EQ(0, echo_canceller.enable_metrics(true));
|
||||||
EXPECT_TRUE(echo_canceller.are_metrics_enabled());
|
EXPECT_TRUE(echo_canceller.are_metrics_enabled());
|
||||||
EXPECT_EQ(0, echo_canceller.enable_metrics(false));
|
EXPECT_EQ(0, echo_canceller.enable_metrics(false));
|
||||||
@ -113,26 +98,13 @@ TEST(EchoCancellationInternalTest, InterfaceConfiguration) {
|
|||||||
EXPECT_EQ(0, echo_canceller.enable_delay_logging(false));
|
EXPECT_EQ(0, echo_canceller.enable_delay_logging(false));
|
||||||
EXPECT_FALSE(echo_canceller.is_delay_logging_enabled());
|
EXPECT_FALSE(echo_canceller.is_delay_logging_enabled());
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(false));
|
|
||||||
EXPECT_FALSE(echo_canceller.is_enabled());
|
|
||||||
|
|
||||||
int median = 0;
|
int median = 0;
|
||||||
int std = 0;
|
int std = 0;
|
||||||
float poor_fraction = 0;
|
float poor_fraction = 0;
|
||||||
EXPECT_EQ(AudioProcessing::kNotEnabledError,
|
EXPECT_EQ(AudioProcessing::kNotEnabledError,
|
||||||
echo_canceller.GetDelayMetrics(&median, &std, &poor_fraction));
|
echo_canceller.GetDelayMetrics(&median, &std, &poor_fraction));
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(true));
|
|
||||||
EXPECT_TRUE(echo_canceller.is_enabled());
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(false));
|
|
||||||
EXPECT_FALSE(echo_canceller.is_enabled());
|
|
||||||
|
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(true));
|
|
||||||
EXPECT_TRUE(echo_canceller.is_enabled());
|
|
||||||
EXPECT_TRUE(echo_canceller.aec_core() != NULL);
|
EXPECT_TRUE(echo_canceller.aec_core() != NULL);
|
||||||
EXPECT_EQ(0, echo_canceller.Enable(false));
|
|
||||||
EXPECT_FALSE(echo_canceller.is_enabled());
|
|
||||||
EXPECT_FALSE(echo_canceller.aec_core() != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -29,7 +29,6 @@ void SetupComponent(int sample_rate_hz,
|
|||||||
EchoControlMobileImpl* echo_control_mobile) {
|
EchoControlMobileImpl* echo_control_mobile) {
|
||||||
echo_control_mobile->Initialize(
|
echo_control_mobile->Initialize(
|
||||||
sample_rate_hz > 16000 ? 16000 : sample_rate_hz, 1, 1);
|
sample_rate_hz > 16000 ? 16000 : sample_rate_hz, 1, 1);
|
||||||
echo_control_mobile->Enable(true);
|
|
||||||
echo_control_mobile->set_routing_mode(routing_mode);
|
echo_control_mobile->set_routing_mode(routing_mode);
|
||||||
echo_control_mobile->enable_comfort_noise(comfort_noise_enabled);
|
echo_control_mobile->enable_comfort_noise(comfort_noise_enabled);
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,6 @@ EchoControlMobileImpl::~EchoControlMobileImpl() {}
|
|||||||
|
|
||||||
void EchoControlMobileImpl::ProcessRenderAudio(
|
void EchoControlMobileImpl::ProcessRenderAudio(
|
||||||
rtc::ArrayView<const int16_t> packed_render_audio) {
|
rtc::ArrayView<const int16_t> packed_render_audio) {
|
||||||
if (!enabled_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RTC_DCHECK(stream_properties_);
|
RTC_DCHECK(stream_properties_);
|
||||||
|
|
||||||
size_t buffer_index = 0;
|
size_t buffer_index = 0;
|
||||||
@ -158,10 +154,6 @@ size_t EchoControlMobileImpl::NumCancellersRequired(
|
|||||||
|
|
||||||
int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
||||||
int stream_delay_ms) {
|
int stream_delay_ms) {
|
||||||
if (!enabled_) {
|
|
||||||
return AudioProcessing::kNoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
RTC_DCHECK(stream_properties_);
|
RTC_DCHECK(stream_properties_);
|
||||||
RTC_DCHECK_GE(160, audio->num_frames_per_band());
|
RTC_DCHECK_GE(160, audio->num_frames_per_band());
|
||||||
RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_output_channels);
|
RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_output_channels);
|
||||||
@ -202,33 +194,6 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio,
|
|||||||
return AudioProcessing::kNoError;
|
return AudioProcessing::kNoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EchoControlMobileImpl::Enable(bool enable) {
|
|
||||||
// Ensure AEC and AECM are not both enabled.
|
|
||||||
RTC_DCHECK(stream_properties_);
|
|
||||||
|
|
||||||
if (enable &&
|
|
||||||
stream_properties_->sample_rate_hz > AudioProcessing::kSampleRate16kHz) {
|
|
||||||
return AudioProcessing::kBadSampleRateError;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enable && !enabled_) {
|
|
||||||
enabled_ = enable; // Must be set before Initialize() is called.
|
|
||||||
|
|
||||||
// TODO(peah): Simplify once the Enable function has been removed from
|
|
||||||
// the public APM API.
|
|
||||||
Initialize(stream_properties_->sample_rate_hz,
|
|
||||||
stream_properties_->num_reverse_channels,
|
|
||||||
stream_properties_->num_output_channels);
|
|
||||||
} else {
|
|
||||||
enabled_ = enable;
|
|
||||||
}
|
|
||||||
return AudioProcessing::kNoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EchoControlMobileImpl::is_enabled() const {
|
|
||||||
return enabled_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EchoControlMobileImpl::set_routing_mode(RoutingMode mode) {
|
int EchoControlMobileImpl::set_routing_mode(RoutingMode mode) {
|
||||||
if (MapSetting(mode) == -1) {
|
if (MapSetting(mode) == -1) {
|
||||||
return AudioProcessing::kBadParameterError;
|
return AudioProcessing::kBadParameterError;
|
||||||
@ -256,10 +221,6 @@ void EchoControlMobileImpl::Initialize(int sample_rate_hz,
|
|||||||
stream_properties_.reset(new StreamProperties(
|
stream_properties_.reset(new StreamProperties(
|
||||||
sample_rate_hz, num_reverse_channels, num_output_channels));
|
sample_rate_hz, num_reverse_channels, num_output_channels));
|
||||||
|
|
||||||
if (!enabled_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AECM only supports 16 kHz or lower sample rates.
|
// AECM only supports 16 kHz or lower sample rates.
|
||||||
RTC_DCHECK_LE(stream_properties_->sample_rate_hz,
|
RTC_DCHECK_LE(stream_properties_->sample_rate_hz,
|
||||||
AudioProcessing::kSampleRate16kHz);
|
AudioProcessing::kSampleRate16kHz);
|
||||||
|
@ -30,9 +30,6 @@ class EchoControlMobileImpl {
|
|||||||
|
|
||||||
~EchoControlMobileImpl();
|
~EchoControlMobileImpl();
|
||||||
|
|
||||||
int Enable(bool enable);
|
|
||||||
bool is_enabled() const;
|
|
||||||
|
|
||||||
// Recommended settings for particular audio routes. In general, the louder
|
// Recommended settings for particular audio routes. In general, the louder
|
||||||
// the echo is expected to be, the higher this value should be set. The
|
// the echo is expected to be, the higher this value should be set. The
|
||||||
// preferred setting may vary from device to device.
|
// preferred setting may vary from device to device.
|
||||||
@ -75,8 +72,6 @@ class EchoControlMobileImpl {
|
|||||||
|
|
||||||
int Configure();
|
int Configure();
|
||||||
|
|
||||||
bool enabled_ = false;
|
|
||||||
|
|
||||||
RoutingMode routing_mode_;
|
RoutingMode routing_mode_;
|
||||||
bool comfort_noise_enabled_;
|
bool comfort_noise_enabled_;
|
||||||
|
|
||||||
|
@ -21,10 +21,6 @@ TEST(EchoControlMobileTest, InterfaceConfiguration) {
|
|||||||
EchoControlMobileImpl aecm;
|
EchoControlMobileImpl aecm;
|
||||||
aecm.Initialize(AudioProcessing::kSampleRate16kHz, 2, 2);
|
aecm.Initialize(AudioProcessing::kSampleRate16kHz, 2, 2);
|
||||||
|
|
||||||
// Turn AECM on
|
|
||||||
EXPECT_EQ(0, aecm.Enable(true));
|
|
||||||
EXPECT_TRUE(aecm.is_enabled());
|
|
||||||
|
|
||||||
// Toggle routing modes
|
// Toggle routing modes
|
||||||
std::array<EchoControlMobileImpl::RoutingMode, 5> routing_modes = {
|
std::array<EchoControlMobileImpl::RoutingMode, 5> routing_modes = {
|
||||||
EchoControlMobileImpl::kQuietEarpieceOrHeadset,
|
EchoControlMobileImpl::kQuietEarpieceOrHeadset,
|
||||||
@ -43,10 +39,6 @@ TEST(EchoControlMobileTest, InterfaceConfiguration) {
|
|||||||
EXPECT_FALSE(aecm.is_comfort_noise_enabled());
|
EXPECT_FALSE(aecm.is_comfort_noise_enabled());
|
||||||
EXPECT_EQ(0, aecm.enable_comfort_noise(true));
|
EXPECT_EQ(0, aecm.enable_comfort_noise(true));
|
||||||
EXPECT_TRUE(aecm.is_comfort_noise_enabled());
|
EXPECT_TRUE(aecm.is_comfort_noise_enabled());
|
||||||
|
|
||||||
// Turn AECM off
|
|
||||||
EXPECT_EQ(0, aecm.Enable(false));
|
|
||||||
EXPECT_FALSE(aecm.is_enabled());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
Reference in New Issue
Block a user