[Speex-dev] [patch] speex AEC state save & restore

Simon Morlat simon.morlat at linphone.org
Tue Apr 5 03:58:00 PDT 2011

Hi Steve,

> That's probably a fair assumption for a desktop machine, but totally 
> bogus for a notebook. Is there a clear way to tell the difference, and 
> make a judgement as to whether this feature should be enabled.
I would say that for a large ammount of embedded device that sit in a
wall for their entire life, this assumption is true.
Also, for smartphones where echo comes from mechanical coupling of mic
and receiver, this is true also.

> It works well if the sound card has synchronised mic and speaker 
> sampling, and is horrible otherwise. So, its great on Macs, and pot luck 
> on PCs. Perhaps the canceller should detect one sampling rate sliding 
> against the other, and talk alternate action?

Yes this is true. The two streams synchronization is key to success. In
mediastreamer2 (linphone's media engine) stream synchronisation is
finally implemented (mediastreamer2/src/speexec.c).
For each buffer read from a soundcard, the same data is expected on the
rtp side. If not enough data, then silence is injected to the soundcard
and used for speex_echo_cancel(). Some control is performed on the input
that comes from rtp to monitor its size. If it grows too much (meaning
that we receive more samples than the soundcard can consume), then I
silently drop samples spread over a long time in a way it can't be

However, for cases where input is a webcam microphone and output a pci
soundcard, this doesn't work well if the two clocks diverge rapidly. I
have no solution yet for this case.


> Steve
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev

More information about the Speex-dev mailing list