From a547f9e52e4d03fdead2a721e9bc71ee70d9f5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <rafael.carre@savoirfairelinux.com> Date: Tue, 20 Sep 2011 12:23:55 -0400 Subject: [PATCH] echo suppressor : more assertions --- daemon/src/audio/echosuppress.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/daemon/src/audio/echosuppress.cpp b/daemon/src/audio/echosuppress.cpp index f32a1da755..e1c08a2f0f 100644 --- a/daemon/src/audio/echosuppress.cpp +++ b/daemon/src/audio/echosuppress.cpp @@ -12,13 +12,12 @@ #include "pj/pool.h" #include "pj/os.h" -#define ECHO_CANCEL_MEM_SIZE 1000 #define SAMPLES_PER_FRAME 160 EchoSuppress::EchoSuppress(pj_pool_t *pool) { - if (pjmedia_echo_create(pool, 8000, SAMPLES_PER_FRAME, 250, 0, PJMEDIA_ECHO_SIMPLE, &echoState) != PJ_SUCCESS) - throw std::runtime_error("EchoCancel: Error: Could not create echo canceller"); + if (pjmedia_echo_create(pool, 8000, SAMPLES_PER_FRAME, 250, 0, PJMEDIA_ECHO_SIMPLE | PJMEDIA_ECHO_NO_LOCK, &echoState) != PJ_SUCCESS) + throw std::runtime_error("EchoCancel: Could not create echo canceller"); } EchoSuppress::~EchoSuppress() @@ -28,13 +27,15 @@ EchoSuppress::~EchoSuppress() void EchoSuppress::putData (SFLDataFormat *inputData, int samples) { - assert(samples = SAMPLES_PER_FRAME); + assert(samples == SAMPLES_PER_FRAME); + assert(sizeof(SFLDataFormat) == sizeof(pj_int16_t)); if (pjmedia_echo_playback(echoState, reinterpret_cast<pj_int16_t *>(inputData)) != PJ_SUCCESS) - _warn("EchoCancel: Warning: Problem while putting input data"); + _warn("EchoCancel: Problem while putting input data"); } void EchoSuppress::getData(SFLDataFormat *outputData) { + assert(sizeof(SFLDataFormat) == sizeof(pj_int16_t)); if (pjmedia_echo_capture(echoState, reinterpret_cast<pj_int16_t *>(outputData), 0) != PJ_SUCCESS) - _warn("EchoCancel: Warning: Problem while getting output data"); + _warn("EchoCancel: Problem while getting output data"); } -- GitLab