Doesn't reliably find PulseAudio socket if not in XDG_RUNTIME_DIR
See https://github.com/flatpak/flatpak/issues/4058. Our copy of flatpak_run_add_pulseaudio_args()
has the same issue.
We should behave more like libpulse does, implementing the logic that uses ${runtime}/native, where ${runtime} can either be:
- $PULSE_RUNTIME_PATH, or
- $XDG_RUNTIME_DIR/pulse, or
- a temporary directory in /tmp that is pointed to by a symlink ~/.pulse/${machine_id}-runtime or
{XDG_CONFIG_HOME:-
HOME/.config}/pulse/${machine_id}-runtime- where ${machine_id} is either the contents of /etc/machine-id, or the contents of /var/lib/dbus/machine-id, or the hostname
While we're there, we should also contribute this code to Flatpak, resolving flatpak#4058 and maybe flatpak#2169.
Edited by Simon McVittie