Adds new AEC API to audio_processing.

One unit test added.
Tested with audioproc_unittest and trybots

TEST=none
BUG=none

Review URL: https://webrtc-codereview.appspot.com/1154004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3613 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2013-03-05 16:53:09 +00:00
parent db3f42782c
commit 91d11b3cdd
4 changed files with 27 additions and 2 deletions

View File

@ -313,6 +313,15 @@ int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) {
return apm_->kNoError;
}
struct AecCore* EchoCancellationImpl::aec_core() const {
CriticalSectionScoped crit_scoped(apm_->crit());
if (!is_component_enabled()) {
return NULL;
}
Handle* my_handle = static_cast<Handle*>(handle(0));
return WebRtcAec_aec_core(my_handle);
}
int EchoCancellationImpl::Initialize() {
int err = ProcessingComponent::Initialize();
if (err != apm_->kNoError || !is_component_enabled()) {

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
#include "audio_processing.h"
#include "processing_component.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/processing_component.h"
namespace webrtc {
class AudioProcessingImpl;
@ -51,6 +51,7 @@ class EchoCancellationImpl : public EchoCancellation,
virtual int enable_delay_logging(bool enable);
virtual bool is_delay_logging_enabled() const;
virtual int GetDelayMetrics(int* median, int* std);
virtual struct AecCore* aec_core() const;
// ProcessingComponent implementation.
virtual void* CreateHandle() const;

View File

@ -16,6 +16,8 @@
#include "webrtc/modules/interface/module.h"
#include "webrtc/typedefs.h"
struct AecCore;
namespace webrtc {
class AudioFrame;
@ -342,6 +344,12 @@ class EchoCancellation {
// last call to |GetDelayMetrics()|.
virtual int GetDelayMetrics(int* median, int* std) = 0;
// Returns a pointer to the low level AEC component. In case of multiple
// channels, the pointer to the first one is returned. A NULL pointer is
// returned when the AEC component is disabled or has not been initialized
// successfully.
virtual struct AecCore* aec_core() const = 0;
protected:
virtual ~EchoCancellation() {}
};

View File

@ -805,6 +805,13 @@ TEST_F(ApmTest, EchoCancellation) {
EXPECT_TRUE(apm_->echo_cancellation()->is_enabled());
EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false));
EXPECT_FALSE(apm_->echo_cancellation()->is_enabled());
EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
EXPECT_TRUE(apm_->echo_cancellation()->is_enabled());
EXPECT_TRUE(apm_->echo_cancellation()->aec_core() != NULL);
EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false));
EXPECT_FALSE(apm_->echo_cancellation()->is_enabled());
EXPECT_FALSE(apm_->echo_cancellation()->aec_core() != NULL);
}
TEST_F(ApmTest, EchoCancellationReportsCorrectDelays) {