20 May
2012
20 May
'12
7:25 p.m.
Hi,
Can snd_pcm_drain() be safely called on a non-running stream - particularly one in SND_PCM_STATE_XRUN? I can demonstrate lock-ups (on rather old Alsa versions, though) when _drain is called on a stream in Xrun but it does seem to vary between hardwares.
However, the docs at:
http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html
suggest that it should be fine.
In our case it seems safer (for widest compatibility) to always check for SND_PCM_STATE_RUNNING, and call snd_pcm_drop() if the stream is not running.
Regards
Alan