Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions quickemu
Original file line number Diff line number Diff line change
Expand Up @@ -1266,15 +1266,17 @@ function check_cocoa_gl_es_support() {
}

function configure_display() {
# Determine which audio driver use between Pulseaudio or ALSA
local AUDIO_DRIVER="pa"
if pidof pipewire >/dev/null 2>&1; then
# Determine which audio driver to use: PipeWire, PulseAudio, or ALSA
# Socket detection is more reliable than process detection on headless servers
local AUDIO_DRIVER="alsa"
local pw_socket="${PIPEWIRE_REMOTE:-${XDG_RUNTIME_DIR}/pipewire-0}"
local pa_socket="${PULSE_SERVER:-${XDG_RUNTIME_DIR}/pulse/native}"

if [ "${QEMU_VER_SHORT}" -ge 81 ] && [ -S "${pw_socket}" ]; then
# QEMU's pipewire audio backend was added in version 8.1
if [ "${QEMU_VER_SHORT}" -ge 81 ]; then
AUDIO_DRIVER="pipewire"
fi
elif ! pidof pulseaudio >/dev/null 2>&1; then
AUDIO_DRIVER="alsa"
AUDIO_DRIVER="pipewire"
elif [ -S "${pa_socket}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: PULSE_SERVER can be a server string (e.g., unix:/path or tcp:host:port), so the -S check will fail for valid PulseAudio configurations and force an ALSA fallback. Consider honoring PULSE_SERVER when set and only socket-checking the unix: variant.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At quickemu, line 1278:

<comment>`PULSE_SERVER` can be a server string (e.g., `unix:/path` or `tcp:host:port`), so the `-S` check will fail for valid PulseAudio configurations and force an ALSA fallback. Consider honoring `PULSE_SERVER` when set and only socket-checking the `unix:` variant.</comment>

<file context>
@@ -1266,15 +1266,17 @@ function check_cocoa_gl_es_support() {
-    elif ! pidof pulseaudio >/dev/null 2>&1; then
-        AUDIO_DRIVER="alsa"
+        AUDIO_DRIVER="pipewire"
+    elif [ -S "${pa_socket}" ]; then
+        AUDIO_DRIVER="pa"
     fi
</file context>

AUDIO_DRIVER="pa"
fi

# Setup the appropriate audio device based on the display output
Expand Down
Loading