I've been having problems on my NanoPi Duo implementing a music streaming service using Alsa PCM to output the audio.
When calling snd_pcm_open with the nonblock flag set, I had snd_pcm_writei returning a broken pipe error several times per day (when continuously playing).
I noticed not setting this flag and, thus, allowing snd_pcm_writei to block until there was enough room in the Alsa PCM buffer, did not show this problem.
This was however unusable because the blocking behaviour slowed down the rest of the software enough to be annoying. I think I solved it now by checking with snd_pcm_avail_update if there's enough room available, otherwise I would not call snd_pcm_writei.
Just wanted to put htis out there for anyone's future reference because I could not find any known issues with setting this flag + I don't understand what's causing this.. If anyone has experienced this as well, or might have a clue what's going on, please let me know
4.19.25-sunxi #5.78 SMP Mon Apr 8 07:46:22 CEST 2019 armv7l GNU/Linux