Skip to content
Snippets Groups Projects
Commit a547f9e5 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

echo suppressor : more assertions

parent 8cef71cd
Branches
Tags
No related merge requests found
...@@ -12,13 +12,12 @@ ...@@ -12,13 +12,12 @@
#include "pj/pool.h" #include "pj/pool.h"
#include "pj/os.h" #include "pj/os.h"
#define ECHO_CANCEL_MEM_SIZE 1000
#define SAMPLES_PER_FRAME 160 #define SAMPLES_PER_FRAME 160
EchoSuppress::EchoSuppress(pj_pool_t *pool) EchoSuppress::EchoSuppress(pj_pool_t *pool)
{ {
if (pjmedia_echo_create(pool, 8000, SAMPLES_PER_FRAME, 250, 0, PJMEDIA_ECHO_SIMPLE, &echoState) != PJ_SUCCESS) 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: Error: Could not create echo canceller"); throw std::runtime_error("EchoCancel: Could not create echo canceller");
} }
EchoSuppress::~EchoSuppress() EchoSuppress::~EchoSuppress()
...@@ -28,13 +27,15 @@ EchoSuppress::~EchoSuppress() ...@@ -28,13 +27,15 @@ EchoSuppress::~EchoSuppress()
void EchoSuppress::putData (SFLDataFormat *inputData, int samples) 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) 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) 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) 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");
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment