Drop the 16kHz sample rate restriction on AECM and zero out higher bands

The restriction has been removed completely and AECM now supports any
number of higher bands. But this has been achieved by always zeroing out the
higher bands, instead of applying a constant gain which is the average over half
of the lower band (like it is done for the AEC), because that would be
non-trivial to implement and we don't want to spend too much time on AECM, since
we want to get rid of it in the long term anyway.

R=peah@webrtc.org, solenberg@webrtc.org, tina.legrand@webrtc.org

Review URL: https://codereview.webrtc.org/1774553002 .

Cr-Commit-Position: refs/heads/master@{#11931}
This commit is contained in:
Alex Luebs
2016-03-09 16:37:56 +01:00
parent 3ecb5c8698
commit f687d53aab
6 changed files with 43 additions and 75 deletions

View File

@ -206,6 +206,12 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio) {
handle_index++;
}
for (size_t band = 1u; band < audio->num_bands(); ++band) {
memset(audio->split_bands(i)[band],
0,
audio->num_frames_per_band() *
sizeof(audio->split_bands(i)[band][0]));
}
}
return AudioProcessing::kNoError;
@ -313,8 +319,8 @@ int EchoControlMobileImpl::Initialize() {
}
}
if (apm_->proc_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) {
LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates";
if (apm_->proc_split_sample_rate_hz() > AudioProcessing::kSampleRate16kHz) {
LOG(LS_ERROR) << "AECM only supports 16 kHz or lower split sample rates";
return AudioProcessing::kBadSampleRateError;
}
@ -370,7 +376,7 @@ int EchoControlMobileImpl::InitializeHandle(void* handle) const {
rtc::CritScope cs_capture(crit_capture_);
assert(handle != NULL);
Handle* my_handle = static_cast<Handle*>(handle);
if (WebRtcAecm_Init(my_handle, apm_->proc_sample_rate_hz()) != 0) {
if (WebRtcAecm_Init(my_handle, apm_->proc_split_sample_rate_hz()) != 0) {
return GetHandleError(my_handle);
}
if (external_echo_path_ != NULL) {