fix: detect actual channel count to prevent Mickey Mouse with mono USB devices#67
Merged
fix: detect actual channel count to prevent Mickey Mouse with mono USB devices#67
Conversation
…B devices Mono USB headsets (e.g. Jabra PRO 930) deliver 1-channel audio through the CATapDescription aggregate device. The code assumed stereo (2ch), treating consecutive mono samples as L/R pairs and averaging them — halving the sample count and producing double-speed Mickey Mouse audio. Fix: read mNumberChannels from AudioBufferList on first IOProc callback, propagate through AudioCaptureResult, and use for channel conversion.
e859ad6 to
065dc60
Compare
Tests verify: mono passthrough (no halving), stereo averaging, sample count preservation, empty input, and incomplete frames.
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.
Summary
AudioBufferList.mNumberChannelson first callbackactualChannelsthroughAudioCaptureResult→AudioCaptureSession→DualSourceRecorderappChannels=2for stereo→mono conversionRoot cause: Jabra PRO 930 USB headset has 1 output channel (mono). The aggregate device delivers mono audio, but the code always assumed stereo interleaved — averaging consecutive mono samples as L/R pairs, halving the sample count, producing double-speed Mickey Mouse voice.
Test Plan