This Cl includes

* A getter for echo_state
* Style changes, such as changes to int where appropriate

TEST=audioproc_unittest, trybots
BUG=None

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3522 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2013-02-15 17:01:03 +00:00
parent 325f625137
commit 21a2fc902d
5 changed files with 34 additions and 30 deletions

View File

@ -716,6 +716,11 @@ int WebRtcAec_GetDelayMetricsCore(aec_t* self, int* median, int* std) {
return 0;
}
int WebRtcAec_echo_state(aec_t* self) {
assert(self != NULL);
return self->echoState;
}
static void ProcessBlock(aec_t* aec) {
int i;
float d[PART_LEN], y[PART_LEN], e[PART_LEN], dH[PART_LEN];

View File

@ -185,5 +185,7 @@ int WebRtcAec_MoveFarReadPtr(aec_t* aec, int elements);
// Calculates the median and standard deviation among the delay estimates
// collected since the last call to this function.
int WebRtcAec_GetDelayMetricsCore(aec_t* self, int* median, int* std);
// Returns the echo state (1: echo, 0: no echo).
int WebRtcAec_echo_state(aec_t* self);
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_SOURCE_AEC_CORE_H_

View File

@ -609,27 +609,24 @@ WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config)
return 0;
}
WebRtc_Word32 WebRtcAec_get_echo_status(void *aecInst, WebRtc_Word16 *status)
{
aecpc_t *aecpc = aecInst;
int WebRtcAec_get_echo_status(void* handle, int* status) {
aecpc_t* self = (aecpc_t*)handle;
if (aecpc == NULL) {
return -1;
}
if (handle == NULL ) {
return -1;
}
if (status == NULL ) {
self->lastError = AEC_NULL_POINTER_ERROR;
return -1;
}
if (self->initFlag != initCheck) {
self->lastError = AEC_UNINITIALIZED_ERROR;
return -1;
}
if (status == NULL) {
aecpc->lastError = AEC_NULL_POINTER_ERROR;
return -1;
}
*status = WebRtcAec_echo_state(self->aec);
if (aecpc->initFlag != initCheck) {
aecpc->lastError = AEC_UNINITIALIZED_ERROR;
return -1;
}
*status = aecpc->aec->echoState;
return 0;
return 0;
}
WebRtc_Word32 WebRtcAec_GetMetrics(void *aecInst, AecMetrics *metrics)

View File

@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_INCLUDE_ECHO_CANCELLATION_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_INCLUDE_ECHO_CANCELLATION_H_
#include "typedefs.h"
#include "webrtc/typedefs.h"
// Errors
#define AEC_UNSPECIFIED_ERROR 12000
@ -199,16 +199,16 @@ WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config);
*
* Inputs Description
* -------------------------------------------------------------------
* void *aecInst Pointer to the AEC instance
* void *handle Pointer to the AEC instance
*
* Outputs Description
* -------------------------------------------------------------------
* WebRtc_Word16 *status 0: Almost certainly nearend single-talk
* int *status 0: Almost certainly nearend single-talk
* 1: Might not be neared single-talk
* WebRtc_Word32 return 0: OK
* int return 0: OK
* -1: error
*/
WebRtc_Word32 WebRtcAec_get_echo_status(void *aecInst, WebRtc_Word16 *status);
int WebRtcAec_get_echo_status(void* handle, int* status);
/*
* Gets the current echo metrics for the session.

View File

@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "echo_cancellation_impl.h"
#include "webrtc/modules/audio_processing/echo_cancellation_impl.h"
#include <cassert>
#include <assert.h>
#include <string.h>
#include "critical_section_wrapper.h"
#include "echo_cancellation.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "audio_processing_impl.h"
#include "audio_buffer.h"
#include "webrtc/modules/audio_processing/aec/include/echo_cancellation.h"
namespace webrtc {
@ -141,7 +141,7 @@ int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
}
WebRtc_Word16 status = 0;
int status = 0;
err = WebRtcAec_get_echo_status(my_handle, &status);
if (err != apm_->kNoError) {
return GetHandleError(my_handle);