[alsa-devel] bug in alsa-lib/snd_pcm_plugin_delay for capture?
perex at perex.cz
Mon Nov 22 15:01:32 CET 2010
On Mon, 22 Nov 2010, pl bossart wrote:
>>> Since the PulseAudio commit 29acfd0e0413a9bd126782763ee2dcf10357546 I
>>> am seeing errors messages telling me that the information reported by
>>> snd_pcm_avail_delay is not accurate on the capture path, more
>>> specifically the delay is lower than the available samples.
>> Could you test patch bellow?
> Nah, no luck. PulseAudio still reports an error and if I add
> assert(*delayp >= *availp) the code bombs out.
> Here is one way to solve the problem. I don't claim it's the right
> one, but it's compatible with the way the availp value is computed,
> and it makes the error message go away in PulseAudio.
The double avail_update() calling seems too expensive to me. Could you
test to use snd_pcm_mmap_capture_avail() instead snd_pcm_avail_update()
calls (to assign both slave_avail and plugin_avail local variables)?
Also, remove the assert. I think that it may be raised when the stream is
in some xrun state (with xrun checks disabled). The avail_update can
return the negative values in this specific configuration.
> While I was at it I also removed the .client_frames and .slave_frames
> methods that no one seems to use. This seems to be dead code that
> hasn't been touched in years.
Good catch. This code was used with the really old rate plugin (this
plugin was recoded completely). I applied this patch.
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
More information about the Alsa-devel