[alsa-devel] bug in alsa-lib/snd_pcm_plugin_delay for capture?

Wim Taymans wim.taymans at collabora.co.uk
Thu Nov 25 19:20:06 CET 2010

On Tue, 2010-11-23 at 08:55 -0600, pl bossart wrote:
> > After rethinking, I believe that the right fix should be to add the
> > 'snd_pcm_mmap_capture_avail(pcm)' to the sd variable - delay(slave) - for
> > the capture direction. You should not bother with avail_update or the slave
> > avail values. The avail_update() capture loop just copied samples from the
> > producer (slave) to the consumer (pcm). It means that the avail becomes
> > lower for the producer (slave) and is increased for the consumer (pcm). The
> > delay(slave) already contains the avail(slave) value.
> >
> > So, the result should be 'delay(slave) + mmap_capture_avail(pcm)'.
> The attached patch implements your recoomendation and makes error
> messages go away in PulseAudio.
> It'd good to know if it improves the perfomance of echo cancellation.
> Wim, can you try it out?

I asked Arun to try it, will let you know if it actually improves things
enough to celebrate. The current next plan to improve AEC between
different devices is to first do further smoothing of the rate
estimation in pa_smoother. and then make the sink (or source) do
resampling to compensate (when we manage to get a stable resampling


> Thanks,
> -Pierre

More information about the Alsa-devel mailing list