aboutsummaryrefslogtreecommitdiff
path: root/tests/test-video-audio-recording-command-structure.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-26 17:08:19 -0600
committerCraig Jennings <c@cjennings.net>2026-02-26 17:08:19 -0600
commit9567fc22efb06399b8f814af88c4fb383cd3c30b (patch)
tree02ade6fb6ae9981d44a7a337c316aa0d89cf59b3 /tests/test-video-audio-recording-command-structure.el
parentd16fec3013797df2b84f2d8881ee42ad1ceef384 (diff)
downloaddotemacs-9567fc22efb06399b8f814af88c4fb383cd3c30b.tar.gz
dotemacs-9567fc22efb06399b8f814af88c4fb383cd3c30b.zip
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-command-structure.el')
-rw-r--r--tests/test-video-audio-recording-command-structure.el72
1 files changed, 54 insertions, 18 deletions
diff --git a/tests/test-video-audio-recording-command-structure.el b/tests/test-video-audio-recording-command-structure.el
index c964b2465..f4c24c39c 100644
--- a/tests/test-video-audio-recording-command-structure.el
+++ b/tests/test-video-audio-recording-command-structure.el
@@ -52,7 +52,9 @@
((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 "wf-recorder" command))))
(test-command-structure-teardown)))
@@ -66,7 +68,9 @@
((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 "wf-recorder -y" command))))
(test-command-structure-teardown)))
@@ -80,7 +84,9 @@
((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 use libx264, not h264
(should (string-match-p "-c libx264" command))
@@ -96,7 +102,9 @@
((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 "-m matroska" command))))
(test-command-structure-teardown)))
@@ -110,7 +118,9 @@
((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 use -f /dev/stdout, not -o -
(should (string-match-p "-f /dev/stdout" command))
@@ -126,7 +136,9 @@
((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)
;; These flags don't exist in wf-recorder
(should-not (string-match-p "--no-audio" command))
@@ -142,7 +154,9 @@
((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 pipe wf-recorder to ffmpeg
(should (string-match-p "wf-recorder.*|.*ffmpeg" command))))
@@ -157,7 +171,9 @@
((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 "ffmpeg -i pipe:0" command))))
(test-command-structure-teardown)))
@@ -173,7 +189,9 @@
((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 "x11grab" command))))
(test-command-structure-teardown)))
@@ -187,7 +205,9 @@
((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-not (string-match-p "wf-recorder" command))))
(test-command-structure-teardown)))
@@ -201,7 +221,9 @@
((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 "-i :0" command))))
(test-command-structure-teardown)))
@@ -216,7 +238,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 "^ffmpeg " command))))
(test-command-structure-teardown)))
@@ -229,7 +253,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 "-f pulse" command))))
(test-command-structure-teardown)))
@@ -242,7 +268,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-command-structure-teardown)))
@@ -258,7 +286,9 @@
((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 "-filter_complex" command))
(should (string-match-p "amerge" command))))
@@ -273,7 +303,9 @@
((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 "-map 0:v" command))
(should (string-match-p "-map.*\\[out\\]" command))))
@@ -288,7 +320,9 @@
((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 "-c:v copy" command))))
(test-command-structure-teardown)))
@@ -302,7 +336,9 @@
((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 "\\.mkv" command))))
(test-command-structure-teardown)))