[xiph-commits] r11162 - in trunk/speex: include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Tue Apr 18 01:35:27 PDT 2006


Author: jm
Date: 2006-04-18 01:35:23 -0700 (Tue, 18 Apr 2006)
New Revision: 11162

Modified:
   trunk/speex/include/speex/speex_echo.h
   trunk/speex/libspeex/mdf.c
Log:
Fixed ring buffer (not, it's not the same as a stack!) in the new API. Some
comments too.


Modified: trunk/speex/include/speex/speex_echo.h
===================================================================
--- trunk/speex/include/speex/speex_echo.h	2006-04-18 01:22:41 UTC (rev 11161)
+++ trunk/speex/include/speex/speex_echo.h	2006-04-18 08:35:23 UTC (rev 11162)
@@ -63,10 +63,10 @@
 /** Performs echo cancellation a frame */
 void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
 
-/** Performs echo cancellation a frame */
+/** Perform echo cancellation using internal playback buffer */
 void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out, spx_int32_t *Yout);
 
-/** Performs echo cancellation a frame */
+/** Let the echo canceller know that a frame was just played */
 void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
 
 /** Reset the echo canceller state */

Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2006-04-18 01:22:41 UTC (rev 11161)
+++ trunk/speex/libspeex/mdf.c	2006-04-18 08:35:23 UTC (rev 11162)
@@ -398,21 +398,23 @@
 
 void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out, spx_int32_t *Yout)
 {
+   int i;
    if (st->play_buf_pos>=st->frame_size)
    {
+      speex_echo_cancel(st, rec, st->play_buf, out, Yout);
       st->play_buf_pos -= st->frame_size;
+      for (i=0;i<st->frame_size;i++)
+         st->play_buf[i] = st->play_buf[i+st->frame_size];
    } else {
-      int i;
       speex_warning("no playback frame available");
-      for (i=0;i<st->frame_size;i++)
-         st->play_buf[i] = 0;
       if (st->play_buf_pos!=0)
       {
          speex_warning("internal playback buffer corruption?");
          st->play_buf_pos = 0;
       }
+      for (i=0;i<st->frame_size;i++)
+         out[i] = rec[i];
    }
-   speex_echo_cancel(st, rec, st->play_buf+st->play_buf_pos, out, Yout);
 }
 
 void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)



More information about the commits mailing list