fix: preserve GPUI lifetime and avoid WASAPI silence warnings

This commit is contained in:
2026-10-13 18:58:37 +02:00
parent d065ad7775
commit 072a4ab7ca
17 changed files with 470 additions and 188 deletions
+28
View File
@@ -81,6 +81,34 @@ swaymsg '[app_id="dev.clipbin.Clipbin"] kill' >/dev/null
wait_windows 0
menu 1
wait_windows 1
# Repeated reopen must release each UI's threads and allocation state.
measure() {
python3 - "${app}" "$1" <<'PYMETRICS'
import pathlib,sys
status=dict(line.split(':',1) for line in pathlib.Path(f'/proc/{sys.argv[1]}/status').read_text().splitlines() if ':' in line)
print(f"{sys.argv[2]}\t{status['Threads'].strip()}\t{status['VmRSS'].split()[0]}")
PYMETRICS
}
measure 0 > "${out}/reopen-metrics.tsv"
for cycle in $(seq 5); do
swaymsg '[app_id="dev.clipbin.Clipbin"] kill' >/dev/null
wait_windows 0
sleep 1
menu 1
wait_windows 1
sleep 1
measure "${cycle}" >> "${out}/reopen-metrics.tsv"
done
cat "${out}/reopen-metrics.tsv"
python3 - "${out}/reopen-metrics.tsv" <<'PYBOUNDS'
import pathlib,sys
rows=[tuple(map(int,line.split())) for line in pathlib.Path(sys.argv[1]).read_text().splitlines()]
assert max(r[1] for r in rows[1:]) <= rows[0][1]+4, rows
# Allow the first reopen to warm caches; later windows must stay bounded.
rss=[r[2] for r in rows[1:]]
assert max(rss)-min(rss) <= 32*1024 and rows[-1][2] <= rows[0][2]+64*1024, rows
print('PASS five close/reopen cycles have bounded thread count and RSS')
PYBOUNDS
# Audio delivery loss must be visible in the application and real tray tooltip.
kill "$(cat "${CLIPBIN_RIG_DIR}/pulse.pid")"
for _ in $(seq 15); do grep -q 'recorder_status=Degraded' "${out}/desktop.log" && break; sleep 1; done
+20
View File
@@ -128,6 +128,26 @@ else
result "${name}" 1
fi
# 10. Silence is healthy: no playback streams, idle >10s before monitor capture.
for mode in silence muted-mic; do
name="audio-${mode}"
mic=""
setup=""
if [[ "${mode}" == muted-mic ]]; then
mic="--mic"
setup="pactl set-default-source clipbin-rig-sink.monitor; pactl set-source-mute clipbin-rig-sink.monitor 1;"
fi
CLIPBIN_RIG_NO_AUDIO=1 "${rig}" bash -c "sleep 12; test -z \"\$(pactl list short sink-inputs)\" || exit 1; pactl list short sinks | grep SUSPENDED || exit 1; ${setup} '${probe}' record ${mic} --seconds 16 --out '${out}/${name}'; status=\$?; pactl list short sinks; exit \$status" \
> "${out}/${name}.log" 2>&1
probe_exit=$?
if [[ "${probe_exit}" == 0 ]] && has "${out}/${name}.log" "status=Recording" \
&& ! has "${out}/${name}.log" "status=(degraded|failed)"; then
result "${name}" 0 "no playback for >10s, capture remains healthy"
else
result "${name}" 1
fi
done
echo
if [[ "${failures}" == 0 ]]; then
echo "All scenarios passed. Logs in ${out}"