[graphics/digikam] core/app/main: Prefer PulseAudio backend to avoid missing PipeWire audio outputs

Gilles Caulier <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ca48eb65bc754c157673784318e9a6b8dc5f7135 by Gilles Caulier, on behalf of Mark Cockram.
Committed on 22/07/2026 at 19:42.
Pushed by cgilles into branch 'master'.

Prefer PulseAudio backend to avoid missing PipeWire audio outputs

On PipeWire systems Qt >= 6.10 defaults to its native PipeWire audio
backend. Its asynchronous EnumFormat resolution can fail for sinks that
are owned by other PipeWire clients, such as module-filter-chain effect
sinks; the devices are then silently dropped and never appear in
QMediaDevices::audioOutputs(), leaving them missing from the media
player audio output selection. Observed with Qt 6.10.2 (the relevant
code is unchanged in 6.11): the device monitor logs "Could not resolve
audio format" for exactly those nodes while a minimal Qt client on the
same system resolves them fine.

The PulseAudio backend enumerates the same devices through
pipewire-pulse without this defect, so prefer it on Linux when the user
has not chosen a backend explicitly via QT_AUDIO_BACKEND.

M  +19   -0    core/app/main/main.cpp

https://invent.kde.org/graphics/digikam/-/commit/ca48eb65bc754c157673784318e9a6b8dc5f7135

diff --git a/core/app/main/main.cpp b/core/app/main/main.cpp
index 2619353d99..70b1387a61 100644
--- a/core/app/main/main.cpp
+++ b/core/app/main/main.cpp
@@ -181,6 +181,25 @@ MAIN_EXPORT int MAIN_FN(int argc, char** argv)
 
     qputenv("QT_MEDIA_BACKEND", system.videoBackend.toLatin1());
 
+#   if defined Q_OS_LINUX
+
+    if (!qEnvironmentVariableIsSet("QT_AUDIO_BACKEND"))
+    {
+        // On PipeWire systems Qt >= 6.10 defaults to its native PipeWire
+        // audio backend, whose asynchronous format enumeration can fail
+        // for sinks owned by other PipeWire clients (for example
+        // module-filter-chain effect sinks): the affected outputs then
+        // never appear in QMediaDevices::audioOutputs(), so they are
+        // missing from the audio output selection of the media player.
+        // The PulseAudio backend enumerates the same devices through
+        // pipewire-pulse without this defect, so prefer it until the Qt
+        // issue is fixed.
+
+        qputenv("QT_AUDIO_BACKEND", "pulseaudio");
+    }
+
+#   endif
+
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.