[Speex-dev] Echo cancellation and synchronization

Peter Vestberg peter.vestberg at gmail.com
Sun Jan 4 20:04:17 PST 2009


Hi Jean-Marc and all others!

I am having some troubles with the echo cancellation feature of speex in 
a voip project. I have two threads, one for sound input and one for 
sound output.
In the output thread, I call speex_echo_playback(). or every frame sent 
to the sound card. In the input thread, I call speex_echo_capture() for 
every frame captured from the sound card. Also, I do encoding/decoding, 
networking etc.

This all works fine on my MacBook. But when I run the same application 
on a linux machine I continuously receive the following speex warnings:

warning: Had to discard a playback frame (your application is buggy 
and/or got xruns)
warning: Auto-filling the buffer (your application is buggy and/or got 
xruns)
warning: Had to discard a playback frame (your application is buggy 
and/or got xruns)
warning: Auto-filling the buffer (your application is buggy and/or got 
xruns)
...
...

The problem seems to be that the sound output thread (and thus 
speex_echo_playback()) sometimes executes three frames/"iterations" 
before the sound input thread (and thus speex_echo_capture()) comes in. 
How do I deal with this problem? I suspect I cannot really affect how 
often the sound card lib requires a new frame or has one available.

Regards,
Peter


More information about the Speex-dev mailing list