Skip to content

fix(macos): don't report system audio as unauthorized while the Mac is silent - #17

Merged
PCcoding666 merged 1 commit into
masterfrom
fix/macos-tap-silence-false-denial
Oct 10, 2026
Merged

PCcoding666 merged 1 commit into
masterfrom
fix/macos-tap-silence-false-denial

Conversation

@PCcoding666

Copy link
Copy Markdown
Owner

Summary

Fixes a false "not authorized" for system audio introduced with the Core Audio tap (#16).

Root cause (found while testing P2 on a real Mac): a Core Audio process tap only calls back while a tapped process is actually playing. With the Mac silent, an authorized tap delivers no callbacks either. The #16 watchdog treated "no callback within 3 s (twice)" as a denial, so:

  • starting capture on a quiet Mac stopped the system-audio lane after ~6 s with "LCT isn't allowed to record system audio";
  • the onboarding Allow probe reported "Denied" whenever nothing else was playing.

Fix

  • CoreAudioOutputActivity: is any output device running in another process (kAudioDevicePropertyDeviceIsRunningSomewhere and not …IsRunning, so LCT's own microphone engine never counts; LCT's private tap aggregates skipped).
  • Capture watchdog counts only audible time: silence waits indefinitely; output running for 3 s with no callbacks → rebuild the tap once → then report not authorized.
  • Probe taps LCT's own process (SystemAudioTap(target: .ownProcessOnly)) while LCT plays a short digital silence (SilencePlayer), so audio flows exactly when recording is allowed, independent of other apps.

Test results

  • ./Scripts/run_tests.sh: 447 tests, 0 failures, no new warnings; CLT build clean. New tests: nothing playing → never denied; playback starting later → only audible time counts; probe plays and stops silence; capture tap is exclusive-of-LCT while the probe tap is LCT-only. Fakes only — no real tap or audio output in tests.
  • Real Mac (macOS 27): capture started with nothing playing → no notice after 15 s; playback started → "authorized" within 1 s. Onboarding Allow with nothing playing → granted, row ✓ (previously "Denied").

🤖 Generated with Claude Code

…s silent

A Core Audio process tap only calls back while a tapped process is playing.
Starting capture on a quiet Mac produced no callbacks, so the watchdog
declared 'not authorized' and stopped the system-audio lane; the onboarding
probe likewise reported 'Denied'. The watchdog now only counts time during
which an output device is running in another process, and the probe taps
LCT's own process while playing a short silence, so audio flows exactly when
recording is allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@PCcoding666
PCcoding666 merged commit b3b61b3 into master Oct 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants