feat: detect lost sources, stalled writes and low disk space
PipeWire capture keeps its size and last frame after its stream stops, so the recorder follows the stream state OBS logs. Recording fails when the segment on disk stops growing (OBS kept counting bytes into a dead muxer and missed a full disk) and stops while enough space remains to finalise the last segment. Failures stay visible after the output stops. Adds a check command that verifies keyframe-aligned segments and a remux across segment boundaries, and gives the rig desktop audio.
This commit is contained in:
@@ -66,6 +66,11 @@ pipewire > "${rig_dir}/pipewire.log" 2>&1 & pids+=($!)
|
||||
wait_for pipewire '[[ -S "${XDG_RUNTIME_DIR}/pipewire-0" ]]'
|
||||
wireplumber > "${rig_dir}/wireplumber.log" 2>&1 & pids+=($!)
|
||||
pipewire-pulse > "${rig_dir}/pipewire-pulse.log" 2>&1 & pids+=($!)
|
||||
wait_for pipewire-pulse '[[ -S "${XDG_RUNTIME_DIR}/pulse/native" ]]'
|
||||
# No sound card here: route playback to a virtual sink whose monitor OBS
|
||||
# records as desktop audio.
|
||||
pactl load-module module-null-sink sink_name=clipbin-rig-sink > /dev/null
|
||||
pactl set-default-sink clipbin-rig-sink
|
||||
|
||||
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_HEADLESS_OUTPUTS=1 \
|
||||
sway --config "${XDG_CONFIG_HOME}/sway/config" > "${rig_dir}/sway.log" 2>&1 & pids+=($!)
|
||||
@@ -77,18 +82,21 @@ export SWAYSOCK
|
||||
|
||||
dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_RUNTIME_DIR XDG_CONFIG_HOME SWAYSOCK
|
||||
/usr/lib/xdg-desktop-portal-wlr > "${rig_dir}/xdpw.log" 2>&1 & pids+=($!)
|
||||
echo "${pids[-1]}" > "${rig_dir}/xdpw.pid"
|
||||
/usr/lib/xdg-desktop-portal -r > "${rig_dir}/xdp.log" 2>&1 & pids+=($!)
|
||||
|
||||
# A moving 60 FPS picture with a tone, standing in for a game.
|
||||
# A moving 60 FPS picture with a 440 Hz tone, standing in for a game.
|
||||
SDL_VIDEODRIVER=wayland ffplay -loglevel error -fs -window_title clipbin-test-game \
|
||||
-f lavfi "testsrc2=size=${width}x${height}:rate=60,format=yuv420p" \
|
||||
-f lavfi "testsrc2=size=${width}x${height}:rate=60,format=yuv420p[out0];sine=frequency=440:sample_rate=48000[out1]" \
|
||||
> "${rig_dir}/game.log" 2>&1 & pids+=($!)
|
||||
echo "${pids[-1]}" > "${rig_dir}/game.pid"
|
||||
sleep 1
|
||||
|
||||
export CLIPBIN_RIG_DIR="${rig_dir}"
|
||||
echo "rig: ready (WAYLAND_DISPLAY=${WAYLAND_DISPLAY}, logs in ${rig_dir})" >&2
|
||||
status=0
|
||||
"$@" || status=$?
|
||||
if [[ -n "${CLIPBIN_RIG_KEEP_LOGS:-}" ]]; then
|
||||
cp -r "${rig_dir}" "${CLIPBIN_RIG_KEEP_LOGS}"
|
||||
mkdir -p "${CLIPBIN_RIG_KEEP_LOGS}" && cp "${rig_dir}"/*.log "${CLIPBIN_RIG_KEEP_LOGS}/"
|
||||
fi
|
||||
exit "${status}"
|
||||
|
||||
Reference in New Issue
Block a user