probably a bit more consistent audio

This commit is contained in:
jenz 2026-06-30 15:00:04 +01:00
parent 9cba8d4499
commit 0cfde5300c

View File

@ -45,12 +45,17 @@ echo "xrandr result: $(DISPLAY=:99 xrandr | grep '*')"
# ── Start PipeWire stack ──────────────────────────────────────────────────────
export PULSE_RUNTIME_PATH="$XDG_RUNTIME_DIR/pulse"
rm -rf "$PULSE_RUNTIME_PATH"
pipewire &
sleep 1
wireplumber &
sleep 1
# Remove the pulse socket directory that pipewire may have pre-created, then
# immediately recreate it empty and start pipewire-pulse with no gap in
# between — otherwise pipewire can recreate it first and pipewire-pulse
# fails with "File exists" on the socket.
rm -rf "$PULSE_RUNTIME_PATH"
mkdir -p "$PULSE_RUNTIME_PATH"
pipewire-pulse &
# Wait for the PulseAudio-compatible socket
@ -62,6 +67,14 @@ done
export PULSE_SERVER="unix:${PULSE_RUNTIME_PATH}/native"
# Raise the PipeWire scheduling quantum (buffer size). This container runs
# llvmpipe software rendering + vp8enc + opusenc all competing for CPU at
# ~800% on 8 cores. A larger quantum gives the audio graph more buffer
# headroom to absorb brief scheduling jitter, trading a few ms of latency
# (irrelevant for one-way streaming) for fewer audible underruns/crackling.
# Default PipeWire quantum is often 1024; bump to 4096.
pw-metadata -n settings 0 clock.force-quantum 4096 || true
# Virtual microphone — use || true so a pre-existing module doesn't abort
# the script (set -e is active). The "Failure: No such entity" in the old
# logs was module-virtual-source failing; under PipeWire-Pulse we use