Firefox Audio is Broken due to PulseAudio Dependency

Problem: Firefox 52 audio does not work without pulseaudio.

Discussion: pulseaudio is a bloated audio daemon that often fails. In the last years, when ever audio failed on linux, the quickest solution was to uninstall pulseaudio. But the Firefox developers made the mistake to remove support for the underlying audio driver alsa, and insist on the middle layer pulseaudio.
The second problem with distribution packages of pulseaudio is that it depends on lots of things itself like dbus, systemd, consolekit,…
Which leads to the problem: you can’t use firefox on most linux distributions when you prefer a better startup system than systemd.

Solution1: Don’t use Firefox until they fix this.

Solution2: You can compile pulseaudio without dependencies and use it in pure user context:

Download pulseaudio packages, configure it with:

./configure –prefix=/your/homedir/pulseaudio –disable-systemd-daemon –disable-systemd-login –disable-systemd-journal –without-caps –disable-dbus

You might need to install some -dev packages for this configure to work: libsndfile-dev, libspeex-dev, libspeexdsp-dev, ..

make
make install

And add this to your ~/.bashrc (or similar startup script):

export LD_LIBRARY_PATH=/your/homedir/pulseaudio/lib/
/your/homedir/pulseaudio/bin/pulseaudio -D

Then you can start firefox with a local, limited and secured pulseaudio server.

With standard settings pulseaudio grabs the soundcard completely and blocks audio for other alsa software. This egoism is typical for a Lenn* Poett* tool. But it can be changed. Change the following lines in /your/homedir/pulseaudio/etc/pulse/default.pa:

#load-module module-alsa-sink
load-module module-alsa-sink device=dmix

#load-module module-detect

With these settings pulseaudio uses the normal asla mixing features, and allows other software to use audio.

The pulseaudio developer think it’s a good idea to terminate the pulseaudio server after the last client quits, at let the next client “magically” restart the daemon. (I repeat: “let a client application start a daemon”). This remembers me of the days when we all thought inetd was a good idea. Now we no better. There is an option that prevents the pulseaudio service from  dying.

Change this line in ~/pulseaudio/etc/pulse/daemon.conf:

exit-idle-time = -1

This keeps the daemon running.