diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-03 08:54:51 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-03 08:54:51 -0600 |
| commit | 3c9f31b2f1249a2f5911a300ad48a894443d3009 (patch) | |
| tree | 78497c705d58a7f887814c7edea3c132d76f3735 | |
| parent | 35e5c10b64d7e842ee84d81c7b496cc3202091e8 (diff) | |
fix(video-recording): kill orphan wf-recorder on Wayland
On Wayland, video recording uses a shell pipeline: wf-recorder | ffmpeg.
When stopping, SIGINT only reaches ffmpeg, leaving wf-recorder running
as an orphan. This blocks subsequent recordings (0-byte files or no file).
Fix:
- On stop: explicitly pkill wf-recorder before interrupting ffmpeg
- On start: kill any orphan wf-recorder from previous crashes
- Increase finalization wait from 0.2s to 0.5s for proper cleanup
| -rw-r--r-- | modules/video-audio-recording.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/video-audio-recording.el b/modules/video-audio-recording.el index e44f83c8..a0e9970b 100644 --- a/modules/video-audio-recording.el +++ b/modules/video-audio-recording.el @@ -473,6 +473,10 @@ Return t if found, nil otherwise." Uses wf-recorder on Wayland, x11grab on X11." (cj/recording-check-ffmpeg) (unless cj/video-recording-ffmpeg-process + ;; On Wayland, kill any orphan wf-recorder processes from previous crashes + (when (cj/recording--wayland-p) + (call-process "pkill" nil nil nil "-INT" "wf-recorder") + (sit-for 0.1)) (let* ((devices (cj/recording-get-devices)) (mic-device (car devices)) (system-device (cdr devices)) @@ -576,10 +580,15 @@ Use C-; r c to configure which device to use - it must match the device your pho (interactive) (if cj/video-recording-ffmpeg-process (progn + ;; On Wayland, we run wf-recorder | ffmpeg pipeline. + ;; SIGINT only reaches ffmpeg, leaving wf-recorder as orphan. + ;; Kill wf-recorder explicitly first, then ffmpeg will exit naturally. + (when (cj/recording--wayland-p) + (call-process "pkill" nil nil nil "-INT" "wf-recorder")) ;; Use interrupt-process to send SIGINT (graceful termination) (interrupt-process cj/video-recording-ffmpeg-process) ;; Give ffmpeg a moment to finalize the file - (sit-for 0.2) + (sit-for 0.5) (setq cj/video-recording-ffmpeg-process nil) (force-mode-line-update t) (message "Stopped video recording.")) |
