Skip to content

fix: notify Go when SCStream stops unexpectedly and auto-restart speaker source#5

Merged
sangmin7648 merged 1 commit into
mainfrom
claude/fix-speaker-audio-cutoff-zZpx5
Apr 10, 2026
Merged

fix: notify Go when SCStream stops unexpectedly and auto-restart speaker source#5
sangmin7648 merged 1 commit into
mainfrom
claude/fix-speaker-audio-cutoff-zZpx5

Conversation

@sangmin7648

Copy link
Copy Markdown
Owner

When macOS stops the ScreenCaptureKit stream (screen lock, display change,
system error), didStopWithError: was only logging — the Go channel stayed
open but received no data, causing silent hang and the menu-bar indicator
to disappear.

Changes:

  • speaker_darwin.m: call tacitSpeakerStoppedCallback from didStopWithError:
    when the stream is not already in a deliberate-stop path (self.stopped)
  • speaker_darwin.h: declare tacitSpeakerStoppedCallback
  • speaker_darwin.go: replace bare chan[]int16 cgo handle with speakerChan
    (data channel + sync.Once + self-referencing handle) so both the
    unexpected-stop callback and the ctx.Done() goroutine can safely close
    the channel exactly once; add tacitSpeakerStoppedCallback export
  • pipeline.go: split runSource into runSource (retry loop) + runSourceOnce
    so that an unexpected stream closure triggers automatic restart after 5s
    instead of silently stopping the pipeline

https://claude.ai/code/session_01LRhvpcLHSUZT1fz9XvbPny

…ker source

When macOS stops the ScreenCaptureKit stream (screen lock, display change,
system error), didStopWithError: was only logging — the Go channel stayed
open but received no data, causing silent hang and the menu-bar indicator
to disappear.

Changes:
- speaker_darwin.m: call tacitSpeakerStoppedCallback from didStopWithError:
  when the stream is not already in a deliberate-stop path (self.stopped)
- speaker_darwin.h: declare tacitSpeakerStoppedCallback
- speaker_darwin.go: replace bare chan[]int16 cgo handle with speakerChan
  (data channel + sync.Once + self-referencing handle) so both the
  unexpected-stop callback and the ctx.Done() goroutine can safely close
  the channel exactly once; add tacitSpeakerStoppedCallback export
- pipeline.go: split runSource into runSource (retry loop) + runSourceOnce
  so that an unexpected stream closure triggers automatic restart after 5s
  instead of silently stopping the pipeline

https://claude.ai/code/session_01LRhvpcLHSUZT1fz9XvbPny
@sangmin7648 sangmin7648 merged commit 5a0d40a into main Apr 10, 2026
2 checks passed
@sangmin7648 sangmin7648 deleted the claude/fix-speaker-audio-cutoff-zZpx5 branch April 10, 2026 15:26
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