Upcoming pulseaudio interface deprecation


#1

When the pulseaudio interface was written, it was known to be a transitional interface since it gives full access to only pulseaudio (and no other sound servers) without a design for mediating audio recording.

As of 2.41, snapd adds the audio-playback (auto-connected) and audio-record (manually connected) interfaces. These interfaces currently support using the host’s PulseAudio sound server and will be extended to support other sound servers as required (eg, pipewire). In this manner, snaps are future-proofed and need only plugs audio-playback to have access to the configured sound servers on the system (as supported by snapd) as opposed to having to specify multiple interfaces for different sound servers (ie, plugs: [ audio-playback ] vs plugs: [ pulseaudio, pipewire, foo, bar ]).

Furthermore, for host systems that support the snapd-integration patch for pulseaudio, pulseaudio will mediate recording by verifying that the audio-record interface is connected by the client snap.

Next steps

Though the pulseaudio interface is being deprecated, it will not be removed from snapd and you are free to continue plugging pulseaudio as always. In the coming weeks, pulseaudio will change from being auto-connected to being manually connected. During this transition, all existing snaps that currently plugs: [ pulseaudio ] will be grandfathered into auto-connection.

As of today, the forum documentation has been updated to suggest using these new interfaces instead of pulseaudio, the snapcraft-desktop-helpers have been adjusted to plugs: [ audio-playback, pulseaudio ], bugs have been filed in other projects that provide templates (eg, electron), snapd 2.41 is finding its way out to various distributions and the grandfathering of existing snaps has begun.

Your snaps

If your snap currently plugs: [ pulseaudio ], you may want to opt into future-proofing and adjust it to use plugs: [ audio-playback, pulseaudio ] (adding audio-record as desired). Again, this is not required for existing snaps since they will be grandfathered into auto-connection.

Your templates

If you use the snapcraft-desktop-helpers, you may want to verify your new snaps are using the latest version that pull in audio-playback.

If you use another snap template system that still only plugs pulseaudio, feel free fix it to additionally plugs audio-playback and/or report this upstream and report back here.

Happy snapcrafting!


#2

That seems like an elegant way to handle things. Thanks @jdstrand!


#3

#5

FYI, the grandfathering is completed for all snaps with a populated stable channel. I’ve now issued https://github.com/snapcore/snapd/pull/7631 to make pulseaudio manually connect (milestoned for 2.43). @pedronis and I will make sure we’ll do another round of updates when/before 2.43 is released.


#6

@advocacy - besides snapcraft-desktop-helpers and electron-builder, are there any projects that templatize snapcraft.yaml/snap.yaml to add pulseaudio?


#7

It might be useful adding a snapcraft warning so when developers build a snap and only have pulseaudio declaration for new snaps, there will be a cli prompt that warns them of the deprecation and lists the suggested future proofing method.

A similar warning could also be added to launchpad and the build service.

This way we will catch anyone with snaps in non-stable channels, and anyone developing without re-consulting the documentation (existing knowledge).


#8

This is now merged into master and will be in 2.43.


#9

I was thinking of updating the review-tools to have a check for ‘if not grandfathered and plugs pulseaudio and not plugs audio-playback: warn to also plugs audio-playback’ (with a mechanism to override). It probably makes sense for snapcraft to guide as well (though note, snapcraft-desktop-helpers was updated already). cc @pedronis and @sergiusens