fix: let WirePlumber settle before the smoke test starts streams
Streams that appear while WirePlumber is still starting up can wedge its event queue: no default sink is chosen, nothing is linked and volume changes are dropped. This made the smoke test fail intermittently locally and in CI. The test now polls moonmix-probe until a default sink exists before starting the streams, then until the playback stream is linked; four local runs in a row pass. Also play a regular file instead of /dev/zero (PipeWire 1.4's pw-cat exited silently on it in CI) and change the volume of the active sink, since CI's PipeWire 1.4 did not apply a volume set on a suspended null sink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6c7f45d5f9
commit
4147eaeaa4
1 file changed
+23
-7
+23
-7
@@ -33,9 +33,7 @@ context.objects = [
|
||||
media.class = "Audio/Sink" audio.position = [ FL FR ]
|
||||
object.linger = true } }
|
||||
]
|
||||
# The microphone is a loopback virtual source (like echo-cancel) rather than
|
||||
# a null-audio-sink with a Source media class: WirePlumber's event dispatcher
|
||||
# intermittently stalls on the latter, which blocks all linking.
|
||||
# The microphone is a loopback virtual source, like echo-cancel creates.
|
||||
context.modules = [
|
||||
{ name = libpipewire-module-loopback
|
||||
args = {
|
||||
@@ -65,15 +63,31 @@ trap cleanup EXIT INT TERM
|
||||
pipewire >"$XDG_RUNTIME_DIR/pipewire.log" 2>&1 & PIDS="$PIDS $!"
|
||||
sleep 1
|
||||
wireplumber >"$XDG_RUNTIME_DIR/wireplumber.log" 2>&1 & PIDS="$PIDS $!"
|
||||
sleep 2
|
||||
|
||||
# wait_for <pattern>: poll the probe (up to ~20 s) until it prints pattern.
|
||||
wait_for() {
|
||||
for _ in $(seq 1 40); do
|
||||
"$PROBE" 2>/dev/null | grep -q -- "$1" && return 0
|
||||
sleep 0.5
|
||||
done
|
||||
echo "timed out waiting for '$1'"
|
||||
return 1
|
||||
}
|
||||
# Let WirePlumber finish its startup (it has picked a default sink) before
|
||||
# any stream appears: streams that show up while it is still initialising
|
||||
# can wedge its event queue, after which nothing gets linked.
|
||||
wait_for '\[default'
|
||||
LOGS="$XDG_RUNTIME_DIR"
|
||||
# Two minutes of silence as a regular file: older pw-cat (PipeWire 1.4)
|
||||
# silently exits when reading raw audio from /dev/zero.
|
||||
head -c 23040000 /dev/zero > "$LOGS/silence.raw"
|
||||
pw-cat --playback --raw --rate 48000 --channels 2 --format s16 \
|
||||
-P '{ application.name = "Test Player" media.name = "Smoke test tone" }' \
|
||||
/dev/zero >"$LOGS/play.log" 2>&1 & PIDS="$PIDS $!"
|
||||
"$LOGS/silence.raw" >"$LOGS/play.log" 2>&1 & PIDS="$PIDS $!"
|
||||
pw-cat --record --raw --rate 48000 --channels 1 --format s16 \
|
||||
-P '{ application.name = "Test Recorder" media.name = "Mic capture" }' \
|
||||
/dev/null >"$LOGS/record.log" 2>&1 & PIDS="$PIDS $!"
|
||||
sleep 2
|
||||
wait_for 'Test Player | .*-> ' || true
|
||||
|
||||
fail=0
|
||||
OUT="$LOGS/probe.out"
|
||||
@@ -92,7 +106,9 @@ step() {
|
||||
fi
|
||||
}
|
||||
step 'Test Player | 100%'
|
||||
step 'Test Headphones | 50% (-18.06 dB)' volume test_headphones 50
|
||||
# Change the volume of the sink the test stream plays to: in CI (PipeWire
|
||||
# 1.4) a volume set on an idle, suspended null sink was not applied.
|
||||
step 'Test Speakers | 50% (-18.06 dB)' volume test_speakers 50
|
||||
step 'Test Microphone | .*muted' mute test_mic 1
|
||||
step 'Test Headphones | .*\[default\]' default test_headphones
|
||||
STREAM=$("$PROBE" | awk -F: '/Test Player/ {gsub(/ /,"",$1); print $1; exit}')
|
||||
|
||||
Reference in new issue
Block a user