Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
a547f9e5
Commit
a547f9e5
authored
Sep 20, 2011
by
Rafaël Carré
Browse files
echo suppressor : more assertions
parent
8cef71cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
daemon/src/audio/echosuppress.cpp
View file @
a547f9e5
...
@@ -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"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment