Hi, > Lea > > >> Yes. I prefer modifying alsa_transfer_raw(), which makes the framework logic consistent. How do you think about it? >> > > I'm not familiar with this new stuff, but it seems that the return > values were commented out for some reason and maybe forgotten. If > Frederic has no problems with the change to alsa_transfer_raw, I'll do > it that way. > Hi Brad and Lea, No it's not forgotten : what I wanted is to restart audio on errors. I had some failures when trying to recover : when pausing a stream in xmms, an underrun occurs as the alsa device is not closed. However, I didn't investigate the xrun_recovery return value. Lea's patch is interesting but it miss something : the xrun_recovery will ALWAYS return 0 if fed with EPIPE or ESIGPIPE, whether the recovery succeed or not. The cleanest is to keep Lea's patch but remove the two "return 0;" calls in order to "return err;" at the end of the func. The modification to a2dpd.c should not be done. See the following : static int xrun_recovery(snd_pcm_t * handle, int err) { if (err == -EPIPE) { /* under-run */ err = snd_pcm_prepare(handle); if (err < 0) printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err)); return 0; // ------------------------ Remove this line to return err at the end of the func } else if (err == -ESTRPIPE) { while ((err = snd_pcm_resume(handle)) == -EAGAIN) sleep(1); /* wait until the suspend flag is released */ if (err < 0) { err = snd_pcm_prepare(handle); if (err < 0) printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err)); } return 0;// ------------------------ Remove this line to return err at the end of the func } return err; }