[alsa-devel] [patch] snd_pcm_drain and lock-ups
Mike Gorse
mgorse at mgorse.dhs.org
Mon Oct 8 18:34:00 CEST 2007
On Sun, 7 Oct 2007, Jaroslav Kysela wrote:
>>>> I am getting lockups when portaudio
>>>> calls
>>>> snd_pcm_drain, and snd_pcm_rate_drain calls snd_pcm_wait on its
>>>> slave.
>>>>
>>>> Now that I've looked at this more, I'm seeing that it involves
>>>> dmix, since
>>>> a dmix plugin is behind the rate plugin.
>>>>
>>>> The dmix code in alsa-lib is setting a xrun state because
>>>> snd_pcm_mmap_playback_avail returns a large value.
>>>>
>>>> snd_pcm_wait is then called on the slave of the rate pcm, which is
>>>> a pcm
>>>> with a type of SND_PCM_TYPE_ROUTE whose slave is the dmix, but the
>>>> route
>>>> pcm is returning a different value for snd_pcm_mmap_avail than the
>>>> dmix
>>>> pcm, so it is not triggering snd_pcm_wait to check for a xrun.
>>>>
...
> I think we're looking bug on wrong place. If dmix is in XRUN state,
> snd_pcm_poll_descriptors_revents() should return POLLERR, thus the check
> for XRUN should be done in snd_pcm_wait_nocheck() after revents checking.
>
> Could you trace what occurs in your scenario in snd_pcm_wait_nocheck() ?
Looking at the code suggests that snd_pcm_poll_descriptors_revents would
return POLLERR if it ever got called, but it isn't called because poll()
would have to return first, and it doesn't.
Thanks,
-Mike
More information about the Alsa-devel
mailing list