[alsa-devel] Can I stop sound from driver as system error ?
Takashi Sakamoto
o-takashi at sakamocchi.jp
Tue Dec 15 02:48:45 CET 2015
Hi,
On Dec 15 2015 10:25, Kuninori Morimoto wrote:
> I wonder can I stop sound from driver side (not from user-land)
> as system error during playback or capture ?
> How to do it if we can ?
Stop PCM substreams with SNDRV_PCM_STATE_XRUN. In detail, see
implementation of snd_pcm_stop_xrun() available in 3.19 or later. Then,
userspace applications cannot continue to read/write PCM frames via ALSA
uapi.
When using alsa-lib, then, userspace applications receive -EPIPE as
return value of calling PCM APIs. The applications can stop their
operation for PCM character devices, or can also recover the XRUN state
of PCM substream by calling snd_pcm_prepare(). In this case, struct
snd_pcm_ops.prepare() is called again in driver side.
I think tinyalsa works almost the same.
Regards
Takashi Sakamoto
More information about the Alsa-devel
mailing list