Skip to content

runtime: Don't set PulseAudio as default if PULSE_SERVER isn't set

Simon McVittie requested to merge wip/smcv/plain-alsa into master

Since !269 (merged), on systems where PulseAudio is available, we set PULSE_SERVER to a suitable non-empty value, and "lock" it into the environment to avoid it getting overridden by pressure-vessel-launch (in use-cases where we're using that). We also create an /etc/asound.conf in the container's namespace that will make PulseAudio the default for applications that use the ALSA user-space library libasound.so.2, such as Shadowrun Returns.

Conversely, on systems where PulseAudio is not available (for example where the system is using plain ALSA), we "lock" PULSE_SERVER to a null value so that we will actively remove it from the environment if set. However, this caused a regression: we created /etc/asound.conf based on whether PULSE_SERVER was "locked", which effectively meant this was done unconditionally. An /etc/asound.conf that configures PulseAudio to be the default is not going to work on non-PulseAudio systems.

Instead of checking whether PULSE_SERVER is "locked", check whether it's null. This has the desired effect: we configure PulseAudio to be the default if and only if we detected that it's available.

Helps: https://github.com/ValveSoftware/steam-runtime/issues/344
Helps: https://github.com/ValveSoftware/steam-runtime/issues/384


On a more conventionally-configured system, this can be tested by temporarily renaming $XDG_RUNTIME_DIR/pulse to $XDG_RUNTIME_DIR/_pulse so that pressure-vessel cannot detect it. Before this commit, pressure-vessel would still create /etc/asound.conf. Now, it doesn't.

Merge request reports

Loading