diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-06 11:00:42 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-06 11:00:42 -0500 |
| commit | 165189acce74df4dcdda6ef3bb26dd33c6aa6043 (patch) | |
| tree | 95d392021b70d01d215e7c6719f68b2387ddcf6a /tests/test-video-audio-recording--build-video-command.el | |
| parent | e3170c13c3599fe328c9ae33d39a7a80dc952ed9 (diff) | |
| download | dotemacs-165189acce74df4dcdda6ef3bb26dd33c6aa6043.tar.gz dotemacs-165189acce74df4dcdda6ef3bb26dd33c6aa6043.zip | |
fix(recording): stop wf-recorder start-race producing 0.5s fragment files
On Wayland the video start path signalled any running wf-recorder with pkill -INT and then waited a fixed 0.1s before launching a new one. Releasing the compositor capture takes longer than that, so the new wf-recorder launched into a still-held grab, died immediately, and ffmpeg finalized a ~0.5-second fragment .mkv. Seeing nothing record, I'd press the key again and burst out a pile of fragments until the capture finally freed.
I replaced the fixed wait with a poll that waits until no wf-recorder remains (capped at 2s), the same move the stop path already made when it swapped its own fixed wait for cj/recording--wait-for-exit. Two supporting changes came with it. wf-recorder stderr no longer goes to /dev/null, so a failed grab shows up in the process buffer. And the sentinel now tells a ~0.5s failed start from a real stop, saying "failed to start, try again" instead of silently clearing, so one failure doesn't snowball into a blind-retry burst.
The poll and the fail-fast timing are unit-tested. The live capture needs a manual check.
Diffstat (limited to 'tests/test-video-audio-recording--build-video-command.el')
| -rw-r--r-- | tests/test-video-audio-recording--build-video-command.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test-video-audio-recording--build-video-command.el b/tests/test-video-audio-recording--build-video-command.el index 4f290978..1ffce95b 100644 --- a/tests/test-video-audio-recording--build-video-command.el +++ b/tests/test-video-audio-recording--build-video-command.el @@ -27,6 +27,14 @@ (should (string-match-p "-i pipe:0" cmd)) (should (string-match-p "-c:v copy" cmd)))))) +(ert-deftest test-video-audio-recording--build-video-command-normal-wayland-keeps-wf-recorder-stderr () + "Wayland command does not discard wf-recorder stderr, so a failed grab is diagnosable." + (let ((cj/recording-mic-boost 2.0) + (cj/recording-system-volume 1.0)) + (cl-letf (((symbol-function 'executable-find) (lambda (_prog &rest _) t))) + (let ((cmd (cj/recording--build-video-command "mic" "sys" "/tmp/out.mkv" t))) + (should-not (string-match-p "2>/dev/null" cmd)))))) + (ert-deftest test-video-audio-recording--build-video-command-normal-x11-uses-x11grab () "X11 command uses ffmpeg with x11grab, no wf-recorder." (let ((cj/recording-mic-boost 2.0) |
