From 58ef63abd5a9187ee93609f142cb21a933da16c5 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 26 Feb 2026 17:08:19 -0600 Subject: feat(recording): validate system audio device before recording Add pre-recording validation that catches stale or drifted system audio devices before they cause silent recordings. When the default audio output changes (Bluetooth reconnect, device switch) between setup and recording, the monitor device is auto-updated. Warns if no audio is currently playing through the monitored sink. Co-Authored-By: Craig Jennings --- .../test-video-audio-recording-ffmpeg-functions.el | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'tests/test-video-audio-recording-ffmpeg-functions.el') diff --git a/tests/test-video-audio-recording-ffmpeg-functions.el b/tests/test-video-audio-recording-ffmpeg-functions.el index a3bac0cf..549aa317 100644 --- a/tests/test-video-audio-recording-ffmpeg-functions.el +++ b/tests/test-video-audio-recording-ffmpeg-functions.el @@ -52,7 +52,9 @@ (cl-letf (((symbol-function 'start-process-shell-command) (lambda (_name _buffer _command) (setq process-created t) - (make-process :name "fake-video" :command '("sleep" "1000"))))) + (make-process :name "fake-video" :command '("sleep" "1000")))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-video video-recordings-dir) (should process-created) (should cj/video-recording-ffmpeg-process))) @@ -69,7 +71,9 @@ ((symbol-function 'set-process-sentinel) (lambda (_proc sentinel) (should (eq sentinel #'cj/recording-process-sentinel)) - (setq sentinel-attached t)))) + (setq sentinel-attached t))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-video video-recordings-dir) (should sentinel-attached))) (test-ffmpeg-teardown))) @@ -83,7 +87,9 @@ (lambda (_name _buffer _command) (make-process :name "fake-video" :command '("sleep" "1000")))) ((symbol-function 'force-mode-line-update) - (lambda (&optional _all) (setq update-called t)))) + (lambda (&optional _all) (setq update-called t))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-video video-recordings-dir) (should update-called))) (test-ffmpeg-teardown))) @@ -96,7 +102,9 @@ (cl-letf (((symbol-function 'start-process-shell-command) (lambda (_name _buffer cmd) (setq command cmd) - (make-process :name "fake-video" :command '("sleep" "1000"))))) + (make-process :name "fake-video" :command '("sleep" "1000")))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-video video-recordings-dir) (should (string-match-p "test-mic-device" command)) (should (string-match-p "test-monitor-device" command)) @@ -114,7 +122,9 @@ (cl-letf (((symbol-function 'start-process-shell-command) (lambda (_name _buffer _command) (setq process-created t) - (make-process :name "fake-audio" :command '("sleep" "1000"))))) + (make-process :name "fake-audio" :command '("sleep" "1000")))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-audio audio-recordings-dir) (should process-created) (should cj/audio-recording-ffmpeg-process))) @@ -131,7 +141,9 @@ ((symbol-function 'set-process-sentinel) (lambda (_proc sentinel) (should (eq sentinel #'cj/recording-process-sentinel)) - (setq sentinel-attached t)))) + (setq sentinel-attached t))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-audio audio-recordings-dir) (should sentinel-attached))) (test-ffmpeg-teardown))) @@ -145,7 +157,9 @@ (lambda (_name _buffer _command) (make-process :name "fake-audio" :command '("sleep" "1000")))) ((symbol-function 'force-mode-line-update) - (lambda (&optional _all) (setq update-called t)))) + (lambda (&optional _all) (setq update-called t))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-audio audio-recordings-dir) (should update-called))) (test-ffmpeg-teardown))) @@ -158,7 +172,9 @@ (cl-letf (((symbol-function 'start-process-shell-command) (lambda (_name _buffer cmd) (setq command cmd) - (make-process :name "fake-audio" :command '("sleep" "1000"))))) + (make-process :name "fake-audio" :command '("sleep" "1000")))) + ((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) (cj/ffmpeg-record-audio audio-recordings-dir) (should (string-match-p "\\.m4a" command)))) (test-ffmpeg-teardown))) -- cgit v1.2.3