[alsa-devel] PCM states and snd_pcm_drain()

Alan Horstmann gineera at aspect135.co.uk
Sun May 20 19:25:30 CEST 2012


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:


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.



More information about the Alsa-devel mailing list