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:
Per Åhgren
2019-05-03 15:48:47 +02:00
committed by Commit Bot
parent 9356252bfb
commit d547d862d5
9 changed files with 9 additions and 143 deletions

View File

@ -106,10 +106,6 @@ EchoControlMobileImpl::~EchoControlMobileImpl() {}
void EchoControlMobileImpl::ProcessRenderAudio(
rtc::ArrayView<const int16_t> packed_render_audio) {
if (!enabled_) {
return;
}
RTC_DCHECK(stream_properties_);
size_t buffer_index = 0;
@ -158,10 +154,6 @@ size_t EchoControlMobileImpl::NumCancellersRequired(
int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio,
int stream_delay_ms) {
if (!enabled_) {
return AudioProcessing::kNoError;
}
RTC_DCHECK(stream_properties_);
RTC_DCHECK_GE(160, audio->num_frames_per_band());
RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_output_channels);
@ -202,33 +194,6 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio,
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) {
if (MapSetting(mode) == -1) {
return AudioProcessing::kBadParameterError;
@ -256,10 +221,6 @@ void EchoControlMobileImpl::Initialize(int sample_rate_hz,
stream_properties_.reset(new StreamProperties(
sample_rate_hz, num_reverse_channels, num_output_channels));
if (!enabled_) {
return;
}
// AECM only supports 16 kHz or lower sample rates.
RTC_DCHECK_LE(stream_properties_->sample_rate_hz,
AudioProcessing::kSampleRate16kHz);