Return an error when greater than 16 kHz is used with AECM.
BUG=chromium:178040 Review URL: https://webrtc-codereview.appspot.com/1146005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3587 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6648093911
commit
78693fe37c
@ -8,23 +8,24 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "audio_processing_impl.h"
|
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "audio_buffer.h"
|
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||||
#include "critical_section_wrapper.h"
|
#include "webrtc/modules/audio_processing/echo_cancellation_impl.h"
|
||||||
#include "echo_cancellation_impl.h"
|
#include "webrtc/modules/audio_processing/echo_control_mobile_impl.h"
|
||||||
#include "echo_control_mobile_impl.h"
|
#include "webrtc/modules/audio_processing/gain_control_impl.h"
|
||||||
#include "file_wrapper.h"
|
#include "webrtc/modules/audio_processing/high_pass_filter_impl.h"
|
||||||
#include "high_pass_filter_impl.h"
|
#include "webrtc/modules/audio_processing/level_estimator_impl.h"
|
||||||
#include "gain_control_impl.h"
|
#include "webrtc/modules/audio_processing/noise_suppression_impl.h"
|
||||||
#include "level_estimator_impl.h"
|
#include "webrtc/modules/audio_processing/processing_component.h"
|
||||||
#include "module_common_types.h"
|
#include "webrtc/modules/audio_processing/splitting_filter.h"
|
||||||
#include "noise_suppression_impl.h"
|
#include "webrtc/modules/audio_processing/voice_detection_impl.h"
|
||||||
#include "processing_component.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "splitting_filter.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "voice_detection_impl.h"
|
#include "webrtc/system_wrappers/interface/file_wrapper.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
||||||
// Files generated at build-time by the protobuf compiler.
|
// Files generated at build-time by the protobuf compiler.
|
||||||
@ -37,7 +38,6 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
AudioProcessing* AudioProcessing::Create(int id) {
|
AudioProcessing* AudioProcessing::Create(int id) {
|
||||||
|
|
||||||
AudioProcessingImpl* apm = new AudioProcessingImpl(id);
|
AudioProcessingImpl* apm = new AudioProcessingImpl(id);
|
||||||
if (apm->Initialize() != kNoError) {
|
if (apm->Initialize() != kNoError) {
|
||||||
delete apm;
|
delete apm;
|
||||||
@ -76,7 +76,6 @@ AudioProcessingImpl::AudioProcessingImpl(int id)
|
|||||||
num_reverse_channels_(1),
|
num_reverse_channels_(1),
|
||||||
num_input_channels_(1),
|
num_input_channels_(1),
|
||||||
num_output_channels_(1) {
|
num_output_channels_(1) {
|
||||||
|
|
||||||
echo_cancellation_ = new EchoCancellationImpl(this);
|
echo_cancellation_ = new EchoCancellationImpl(this);
|
||||||
component_list_.push_back(echo_cancellation_);
|
component_list_.push_back(echo_cancellation_);
|
||||||
|
|
||||||
@ -192,6 +191,10 @@ int AudioProcessingImpl::set_sample_rate_hz(int rate) {
|
|||||||
rate != kSampleRate32kHz) {
|
rate != kSampleRate32kHz) {
|
||||||
return kBadParameterError;
|
return kBadParameterError;
|
||||||
}
|
}
|
||||||
|
if (echo_control_mobile_->is_enabled() && rate > kSampleRate16kHz) {
|
||||||
|
LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates";
|
||||||
|
return kUnsupportedComponentError;
|
||||||
|
}
|
||||||
|
|
||||||
sample_rate_hz_ = rate;
|
sample_rate_hz_ = rate;
|
||||||
samples_per_channel_ = rate / 100;
|
samples_per_channel_ = rate / 100;
|
||||||
|
@ -8,16 +8,16 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "echo_control_mobile_impl.h"
|
#include "webrtc/modules/audio_processing/echo_control_mobile_impl.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "critical_section_wrapper.h"
|
#include "webrtc/modules/audio_processing/aecm/include/echo_control_mobile.h"
|
||||||
#include "echo_control_mobile.h"
|
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
|
||||||
|
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||||
#include "audio_processing_impl.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "audio_buffer.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ int EchoControlMobileImpl::Initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (apm_->sample_rate_hz() == apm_->kSampleRate32kHz) {
|
if (apm_->sample_rate_hz() == apm_->kSampleRate32kHz) {
|
||||||
// AECM doesn't support super-wideband.
|
LOG(LS_ERROR) << "AECM only supports 16 kHz or lower sample rates";
|
||||||
return apm_->kBadSampleRateError;
|
return apm_->kBadSampleRateError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,6 +885,11 @@ TEST_F(ApmTest, EchoControlMobile) {
|
|||||||
EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(32000));
|
EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(32000));
|
||||||
EXPECT_EQ(apm_->kBadSampleRateError,
|
EXPECT_EQ(apm_->kBadSampleRateError,
|
||||||
apm_->echo_control_mobile()->Enable(true));
|
apm_->echo_control_mobile()->Enable(true));
|
||||||
|
EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(16000));
|
||||||
|
EXPECT_EQ(apm_->kNoError,
|
||||||
|
apm_->echo_control_mobile()->Enable(true));
|
||||||
|
EXPECT_EQ(apm_->kUnsupportedComponentError, apm_->set_sample_rate_hz(32000));
|
||||||
|
|
||||||
// Turn AECM on (and AEC off)
|
// Turn AECM on (and AEC off)
|
||||||
Init(16000, 2, 2, 2, false);
|
Init(16000, 2, 2, 2, false);
|
||||||
EXPECT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(true));
|
EXPECT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(true));
|
||||||
|
Loading…
Reference in New Issue
Block a user