Commit a547f9e5 authored by Rafaël Carré's avatar Rafaël Carré

echo suppressor : more assertions

parent 8cef71cd
......@@ -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");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment