[asterisk-commits] dvossel: branch dvossel/kill_the_echo r317431 - /team/dvossel/kill_the_echo/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 5 17:13:52 CDT 2011
Author: dvossel
Date: Thu May 5 17:13:48 2011
New Revision: 317431
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317431
Log:
more experimentation
Modified:
team/dvossel/kill_the_echo/funcs/func_echocancel.c
Modified: team/dvossel/kill_the_echo/funcs/func_echocancel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/kill_the_echo/funcs/func_echocancel.c?view=diff&rev=317431&r1=317430&r2=317431
==============================================================================
--- team/dvossel/kill_the_echo/funcs/func_echocancel.c (original)
+++ team/dvossel/kill_the_echo/funcs/func_echocancel.c Thu May 5 17:13:48 2011
@@ -44,6 +44,9 @@
struct echocancel_data {
int16_t buf[4048];
+ int16_t last[4048];
+ int lastlen;
+
struct ast_audiohook audiohook;
unsigned int samplerate;
SpeexEchoState *echo_state;
@@ -106,10 +109,12 @@
echo_data_set(ast_format_rate(&f->subclass.format), echodata);
if (direction == AST_AUDIOHOOK_DIRECTION_WRITE) {
- speex_echo_playback(echodata->echo_state, (int16_t *) f->data.ptr);
+ memcpy(echodata->last, f->data.ptr, f->datalen);
+ echodata->lastlen = f->datalen;
} else {
memcpy(echodata->buf, f->data.ptr, f->datalen);
- speex_echo_capture(echodata->echo_state, echodata->buf, (int16_t *) f->data.ptr);
+ memset(f->data.ptr, 0, f->datalen);
+ speex_echo_cancellation(echodata->echo_state, echodata->buf, echodata->last, (int16_t *) f->data.ptr);
}
return 0;
More information about the asterisk-commits
mailing list