Skip to content

pv-runtime: Use a closer match for 99-pulseaudio-default.conf

Simon McVittie requested to merge wip/sr623-pulse-default into main

pcm.!default pulse assumes that a device named pulse already exists in the configuration (which it might, but equally it might not) and overwrites (because of the !) the definition of the default device with an alias for pulse, which could be written as

pcm_devices["default"] = pcm_devices["pulse"]

in a somewhat more conventional language.

In contrast to that, pcm.!default { type pulse } overwrites the definition of the default device with a newly-defined device whose type is pulse, more like this pseudocode:

pcm_devices["default"] = new PcmDevice(type="pulse")

The latter is what 99-pulseaudio-default.conf.example actually does, and therefore what the fdo runtime's 99-pulseaudio-default.conf actually does (because it's just a copy of 99-pulseaudio-default.conf.example, see https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/commit/870889cdde734557298b8e0e4506e275cacb4f90 for the precise implementation).

In pressure-vessel we write this to /etc/asound.conf rather than into /etc/alsa/conf.d/ because very old versions of libasound like the one in Steam Runtime 1 'scout' only supported the former and not the latter, but otherwise we intend to mimic what the fdo runtime does, so let's mimic it a little closer. This should make games and other programs that output via libasound, like Shadowrun Returns and aplay, more reliable in the container.

One other minor divergence from 99-pulseaudio-default.conf.example is that we don't set the human-readable name Default ALSA Output (currently PulseAudio Sound Server) on the device, which seems a bit much for a targeted fix.

Thanks: Nozomi Miyamori
Resolves: https://github.com/ValveSoftware/steam-runtime/issues/623


Untested. To test this, we need to use a game or program inside the container that will output via libasound, without going like a higher-level middleware library like SDL, OpenAL or FMod: perhaps an aplay binary copied from the corresponding Debian release into ~/tmp, or maybe Shadowrun Returns (which is the reason we added this in the first place).

Edited by Simon McVittie

Merge request reports

Loading