I finally unheld firefox and upgraded from v56 to v59.0.2 yesterday and then
discovered this audio problem.
Fortunately, there is a workæround until this gets fixed: manually create the
pulseaudio symlink that firefox wants.
Here's how I did it on my system:
1. I noticed the following in ~/.xsessīon-errors when I clicked the Play
button on a Youtube video:
Failed to create secure directory (/home/cas/.config/pulse): Permission
denied
SOLUTION: mkdir ~/.config/pulse
2. I then clicked Play again and saw this in ~/.xsession-errors:
[Child 23196, MediaPlayback #3] WARNING: 7fffb6fc3040 Can't get cubeb
context!: file /build/firefox-1WCMqy/firefox-59.0.2/dom/media/AudioStream.cpp,
line 358
[Child 23196, MediaPlayback #3] WARNING: Decoder=7fff965c1d40
[OnMediaSinkAudioError]: file
/build/firefox-1WCMqy/firefox-59.0.2/dom/media/MediaDecoderStateMachine.cpp,
line 3755
Failed to symlink
/home/cas/.config/pulse/7b0498e84e8a11e898a00023cdb023b9-runtime to
/tmp/user/1000/pulse-Std1iWC6tOKU: Permission denied
Failed to symlink
/home/cas/.config/pulse/7b0498e84e8a11e898a00023cdb023b9-runtime to
/tmp/user/1000/pulse-tym1q4HFRUl2: Permission denied
I have no idea why firefox is trying to make two symlinks to two completely
different pulseaudio directories in $TMP (neither of which actually exist),
but the solution here is to:
2a. find out what the real pulseaudio tmp directory is:
$ ls -ld /tmp/user/1000/pulse-*
drwx-- 2 cas cas 4 May 2 12:30 /tmp/user/1000/pulse-ecaLwQPLe0xr/
2b. create the symlink manually:
$ ln -s /tmp/user/1000/pulse-ecaLwQPLe0xr/
/home/cas/.config/pulse/7b0498e84e8a11e898a00023cdb023b9-runtime
The "7b0498e84e8a11e898a00023cdb023b9-runtime" was copy-pasted from the error
message.
Youtube videos etc now have sound.
NOTE: THIS IS NOT A REAL FIX. It will have to be repeated every time firefox
gets restarted. This script will at least automate the annoyance:
#!/bin/bash
set -e
# find the current pulse-audio directory in $TMP
pulsetmpdir=$(find "$TMP" -name 'pulse-*' | tail -1)
# find the most recent firefox error about not being able to create the
symlink
ffpulse=$(awk -v pulseconf="$HOME/.config/pulse" '/Failed to symlink/ && $4
~ pulseconf { link = $4}; END {print link}' ~/.xsession-errors)
[ -n "$pulsetmpdir" ] && [ -n "$ffpulse ] && ln -s "$pulsetmpdir" "$ffpulse"
Unfortunately, I can't use this in a wrapper script to run firefox because the
error message won't appear in the .xsession-errors file until AFTER firefox
tries to play some audio.
I guess I could write a perl File::Tail script or similar that monitors
~/.xsession-errors and creates the symlink whenever needed, but hopefully this
will be fixed in FF 60 and I won't need to.
BTW, I just noticed something odd. I have two firefox sessions running
simultaneously and creating that one symlink just worked for BOTH sessions -
I was expecting to have to create a second symlink for the second session.
Maybe the symlink only has to be created once per login session, not every
time firefox is restarted - I'd have to look at the ffox code to find out.
craig
--
craig sanders