I've been working on that for a couple of month now, but still don't have a very good solution.
My general problem is that my PulseAudio over ALSA audio output is blocked or stuck, I can unblock it when I modify the volume and it will resume playing. The stuck state happens totally randomly, with a slightly higher chance of happening between tracks or when a completely new file is played.
My setup is a headless Raspberry Pi 2 on the latest firmware (4.4.11-v7+ #888) as of now. I'm running Pulseaudio as a system daemon. What I'm actually trying to achieve is stable audio output via Pulseaudio from librespot, a spotify client library. Librespot is actually under my control because I contributed the pulseaudio output. I can play perfectly fine over the librespot → pulseaudio → bluetooth stack for several hours, but for the librespot → pulseaudio → alsa output I get this random blocking relatively often. This is all local and no network playback involved.
As I don't have this issues with Bluetooth output (to Bluetooth speakers) I actually either suspect ALSA itself or Pulseaudio on the ALSA output.
I basically tried every tutorial on the web when it comes to optimizing the ALSA module for PulseAudio (tsched options)
I can somewhat reproduce it on purpose when I try to play something with aplay while librespot output is running as well. The whole aplay command will be frozen till I modify the mixer, then both tracks are played fine. But that does not happen all the time.
Even logging PulseAudio on debug does not really give any hint to what is actually happening.
The question here is in general: does anyone have same the issue with PulseAudio over ALSA?
Todays googling brought up https://github.com/raspberrypi/linux/issues/688. Apparently other people have the same issue as well.
Seems to be a driver issue:
Aug 27 13:35:42 playpi pulseaudio: [alsa-sink-bcm2835 ALSA] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write. Aug 27 13:35:42 playpi pulseaudio: [alsa-sink-bcm2835 ALSA] alsa-sink.c: Most likely this is a bug in the ALSA driver '(null)'. Please report this issue to the ALSA developers. Aug 27 13:35:42 playpi pulseaudio: [alsa-sink-bcm2835 ALSA] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.