Draft
Conversation
Use ScreenCaptureKit (macOS 13.0+) to capture system audio and mix it into the microphone audio stream when screen sharing with audio: true. - ScreenAudioCapturer: wraps SCStream to capture system audio into a thread-safe ring buffer (mono float32, 48kHz) - ScreenAudioMixer: ExternalAudioProcessingDelegate that reads from the ring buffer and mixes system audio into the mic's RTCAudioBuffer - FlutterRTCDesktopCapturer: parses audio constraint in getDisplayMedia, starts/stops screen audio capture lifecycle - Weakly links ScreenCaptureKit so the plugin still works on macOS 10.15+ - Excludes current process audio by default to prevent echo
Use consistent flags (kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment) in both the sizing and retrieval calls to CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer. The alignment flag increases the required buffer size, so using flags=0 for sizing and the alignment flag for retrieval produced an undersized allocation.
Temporary debug logs at 4 checkpoints to identify where audio is lost: 1. SCStream audio callback firing (format, frame count) 2. Ring buffer state after write (available frames) 3. Mixer invocation (called? capturer ready?) 4. Frames read + sample values (system audio vs mic scale) Rate-limited to every 100th callback to avoid log flooding.
The screen audio capture feature is working correctly; remove the debug checkpoints that were added to trace the audio flow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.