From f47573e8eddb02db7f3cbf79a8c1825bf1b32323 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 26 Feb 2026 17:51:40 -0600 Subject: fix(recording): remove drift detection that overrides explicit sink choice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Validation Check 2 (default sink drifted) would silently replace the user's explicit sink selection from quick-setup with the default sink's monitor on every recording start. Removed it — if the device still exists, trust the user's choice. The no-audio warning (Check 3) already catches wrong-sink scenarios. Also fix commentary: device selection does not persist across sessions (both vars are plain defvar), and update validation section to match the two remaining checks. --- ...-video-audio-recording-validate-system-audio.el | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'tests/test-video-audio-recording-validate-system-audio.el') diff --git a/tests/test-video-audio-recording-validate-system-audio.el b/tests/test-video-audio-recording-validate-system-audio.el index a8aaed12..ee85d94c 100644 --- a/tests/test-video-audio-recording-validate-system-audio.el +++ b/tests/test-video-audio-recording-validate-system-audio.el @@ -73,32 +73,30 @@ (should (cl-some (lambda (m) (string-match-p "no longer exists" m)) messages)))) (test-validate-teardown))) -(ert-deftest test-validate-system-audio-normal-drifted-default-auto-updates () - "Test that device is updated when default sink has drifted." +(ert-deftest test-validate-system-audio-normal-respects-explicit-non-default-choice () + "Test that an existing non-default device is NOT overridden by drift detection." (test-validate-setup) (unwind-protect - (let ((cj/recording-system-device "alsa_output.pci-0000.hdmi-stereo.monitor") - (messages nil)) + (let ((cj/recording-system-device "alsa_output.pci-0000.hdmi-stereo.monitor")) (cl-letf (((symbol-function 'shell-command-to-string) (lambda (cmd) (cond ((string-match-p "sources short" cmd) - ;; Old device still exists + ;; Device still exists (concat "65\talsa_output.pci-0000.hdmi-stereo.monitor\tPipeWire\ts32le 2ch 48000Hz\tSUSPENDED\n" "69\talsa_output.usb-Jabra-00.analog-stereo.monitor\tPipeWire\ts32le 2ch 48000Hz\tSUSPENDED\n")) ((string-match-p "sinks short" cmd) - "69\talsa_output.usb-Jabra-00.analog-stereo\tPipeWire\ts32le 2ch 48000Hz\tSUSPENDED\n") - ((string-match-p "sink-inputs" cmd) "Sink Input #1\n\tSink: 69\n") - ;; But default has changed to Jabra + "65\talsa_output.pci-0000.hdmi-stereo\tPipeWire\ts32le 2ch 48000Hz\tRUNNING\n") + ((string-match-p "sink-inputs" cmd) "Sink Input #1\n\tSink: 65\n") + ;; Default is Jabra, but user explicitly chose HDMI ((string-match-p "get-default-sink" cmd) "alsa_output.usb-Jabra-00.analog-stereo") (t "")))) - ((symbol-function 'message) - (lambda (fmt &rest args) - (push (apply #'format fmt args) messages)))) + ((symbol-function 'message) (lambda (_fmt &rest _args) nil)) + ((symbol-function 'cj/log-silently) (lambda (_fmt &rest _args) nil))) (cj/recording--validate-system-audio) - (should (equal "alsa_output.usb-Jabra-00.analog-stereo.monitor" - cj/recording-system-device)) - (should (cl-some (lambda (m) (string-match-p "default output changed" m)) messages)))) + ;; Should keep the user's explicit HDMI choice, not drift to Jabra + (should (equal "alsa_output.pci-0000.hdmi-stereo.monitor" + cj/recording-system-device)))) (test-validate-teardown))) (ert-deftest test-validate-system-audio-normal-no-audio-warns () -- cgit v1.2.3