Refactor ring_buffer interface, add a feature and a test.

* Add a RingBuffer typedef.
* Add the ability to force a memcpy by passing a null ptr. In some cases,
  we know we want a memcpy. This allows us to skip a potential
  intermediate memcpy.
* Add a stress test.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3567 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org
2013-02-25 17:07:35 +00:00
parent 8a0662306d
commit 9ae1354e25
9 changed files with 224 additions and 84 deletions

View File

@ -15,6 +15,7 @@
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_processing/aecm/aecm_defines.h"
#include "webrtc/modules/audio_processing/utility/ring_buffer.h"
#include "webrtc/typedefs.h"
#ifdef _MSC_VER // visual c++
@ -37,10 +38,10 @@ typedef struct {
int lastKnownDelay;
int firstVAD; // Parameter to control poorly initialized channels
void *farFrameBuf;
void *nearNoisyFrameBuf;
void *nearCleanFrameBuf;
void *outFrameBuf;
RingBuffer* farFrameBuf;
RingBuffer* nearNoisyFrameBuf;
RingBuffer* nearCleanFrameBuf;
RingBuffer* outFrameBuf;
WebRtc_Word16 farBuf[FAR_BUF_LEN];

View File

@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <stdlib.h>
//#include <string.h>
#include "webrtc/modules/audio_processing/aecm/include/echo_control_mobile.h"
#include "echo_control_mobile.h"
#include "aecm_core.h"
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "ring_buffer.h"
#ifdef AEC_DEBUG
#include <stdio.h>
#endif
#include <stdlib.h>
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_processing/aecm/aecm_core.h"
#include "webrtc/modules/audio_processing/utility/ring_buffer.h"
#define BUF_SIZE_FRAMES 50 // buffer size (frames)
// Maximum length of resampled signal. Must be an integer multiple of frames
@ -66,7 +66,7 @@ typedef struct
FILE *postCompFile;
#endif // AEC_DEBUG
// Structures
void *farendBuf;
RingBuffer *farendBuf;
int lastError;

View File

@ -11,7 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AECM_INCLUDE_ECHO_CONTROL_MOBILE_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AECM_INCLUDE_ECHO_CONTROL_MOBILE_H_
#include "typedefs.h"
#include <stdlib.h>
#include "webrtc/typedefs.h"
enum {
AecmFalse = 0,