0
StijnVM

Alsa SND_PCM_NONBLOCK broken pipe issues

Recommended Posts

Hi guys,

 

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

Share this post


Link to post
Share on other sites

Wrong :) Still had issues.

Issue seemed to be Alsa functions were called too quickly? For example, snd_pcm_avail  sometimes returned a broken pipe error. 

Now I added a 10ms delay between calls to Alsa and seems to be stable..

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0