diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-26 17:08:19 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-26 17:08:19 -0600 |
| commit | 58ef63abd5a9187ee93609f142cb21a933da16c5 (patch) | |
| tree | 048052e931d218cac1930d736739e11e491b4e7b /tests/test-video-audio-recording-process-cleanup.el | |
| parent | f473f610b7fccffd3d10d8e81342218cd4ab25fc (diff) | |
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 <c@cjennings.net>
Diffstat (limited to 'tests/test-video-audio-recording-process-cleanup.el')
| -rw-r--r-- | tests/test-video-audio-recording-process-cleanup.el | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/tests/test-video-audio-recording-process-cleanup.el b/tests/test-video-audio-recording-process-cleanup.el index d1cd442c..42b5b96d 100644 --- a/tests/test-video-audio-recording-process-cleanup.el +++ b/tests/test-video-audio-recording-process-cleanup.el @@ -166,7 +166,9 @@ so ffmpeg sees EOF on its video input pipe and starts finalizing the file." 0)) ((symbol-function 'start-process-shell-command) (lambda (_name _buffer _command) - (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 pkill-called) (should (member "-INT" pkill-args)) @@ -186,7 +188,9 @@ so ffmpeg sees EOF on its video input pipe and starts finalizing the file." 0)) ((symbol-function 'start-process-shell-command) (lambda (_name _buffer _command) - (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-not pkill-called))) (test-cleanup-teardown))) @@ -299,13 +303,15 @@ This is an integration test that requires wf-recorder and Wayland." (skip-unless (cj/recording--wayland-p)) (test-cleanup-setup) (unwind-protect - (let ((initial-count (test-cleanup--count-wf-recorder-processes))) - (cj/ffmpeg-record-video video-recordings-dir) - (sit-for 1.0) - (should (> (test-cleanup--count-wf-recorder-processes) initial-count)) - (cj/video-recording-stop) - (sit-for 1.0) - (should (= (test-cleanup--count-wf-recorder-processes) initial-count))) + (cl-letf (((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) + (let ((initial-count (test-cleanup--count-wf-recorder-processes))) + (cj/ffmpeg-record-video video-recordings-dir) + (sit-for 1.0) + (should (> (test-cleanup--count-wf-recorder-processes) initial-count)) + (cj/video-recording-stop) + (sit-for 1.0) + (should (= (test-cleanup--count-wf-recorder-processes) initial-count)))) (test-cleanup-teardown) (ignore-errors (call-process "pkill" nil nil nil "-INT" "wf-recorder")))) @@ -317,7 +323,8 @@ This is an integration test that requires wf-recorder and Wayland." (skip-unless (cj/recording--wayland-p)) (test-cleanup-setup) (unwind-protect - (progn + (cl-letf (((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) ;; Create an orphan wf-recorder (simulating a crash) (start-process "orphan-wf" nil "wf-recorder" "-c" "libx264" "-m" "matroska" "-f" "/dev/null") (sit-for 0.5) @@ -342,13 +349,15 @@ This is an integration test that requires wf-recorder and Wayland." (skip-unless (cj/recording--wayland-p)) (test-cleanup-setup) (unwind-protect - (let ((initial-count (test-cleanup--count-wf-recorder-processes))) - (dotimes (_ 3) - (cj/ffmpeg-record-video video-recordings-dir) - (sit-for 0.5) - (cj/video-recording-stop) - (sit-for 0.5)) - (should (= (test-cleanup--count-wf-recorder-processes) initial-count))) + (cl-letf (((symbol-function 'cj/recording--validate-system-audio) + (lambda () nil))) + (let ((initial-count (test-cleanup--count-wf-recorder-processes))) + (dotimes (_ 3) + (cj/ffmpeg-record-video video-recordings-dir) + (sit-for 0.5) + (cj/video-recording-stop) + (sit-for 0.5)) + (should (= (test-cleanup--count-wf-recorder-processes) initial-count)))) (test-cleanup-teardown) (ignore-errors (call-process "pkill" nil nil nil "-INT" "wf-recorder")))) |
