I have experienced similar issues using ALSA. Initially it was very frustrating, but I soon came to believe that it is not really an actual "problem"; rather sporadic negative error codes are a natural part of working with ALSA, and/or my own inexperience with ALSA.

How I came to that conclusion is partly from reading the "pcm.c" source file, in the ALSA C library reference.


You'll see in the various playback loops, a function named xrun_recovery() (line 222) is called whenever any of the ALSA functions return a negative value. xrun_recovery() attempts to recover the ALSA handle, and put it back into a usable state. If xrun_recovery() fails to recover from the error, then the program knows it's truly critical, and terminates.

I use a version of xrun_recovery() in the playback loops of my own apps, and all my -EPIPE errors and so on have disappeared (except for the errors that are due to actual unrecoverable errors).

Possible reasons why your code runs fine on the desktop, but not on the Gumstix, is probably related to the audio drivers and hardware differences. The ALSA library presents an abstract interface to the audio hardware, which allows the same code to be compiled and run on the desktop or Gumstix. However the behaviour of the drivers may be different, causing the same ALSA functions to return different return values, which could explain your observations.


On 11-12-30 04:10 PM, Blaine wrote:
Hi everyone. We have an issue with alsa that I was hoping someone could help us out with.

We have a server application that accepts data over the network and plays it via the alsa api. This works just fine on our desktop, but it "under runs" on the gumstix board. The data is received correctly, however, because when it is dumped to a file, "aplay" plays it back just fine.

snd_pcm_writei returns an EPIPE error.

Does anyone have any suggestions? Why would it be under running on the gumstix, but works fine on a desktop? I don't think processing power is an issue.


Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox

gumstix-users mailing list