Repository navigation
Conversation
…A2DP AirPods drop from the A2DP link to HFP/SCO as soon as anything opens the headset microphone, which halves the output quality. The default input flipping to the headset is the usual trigger, and the existing input lock does not cover it: priority rules and macOS auto-switching on connect can still move the default input. Add an opt-in guard that keeps the default input on the built-in mic: - refuses Bluetooth inputs in FineTune's device pickers - re-pins the built-in mic on connect, wake, default-input change and Bluetooth sample-rate changes, rate limited so it cannot write in a loop - surfaces a call-mode hint when a Bluetooth output runs below 44.1 kHz - states in the UI that an app opening the headset mic directly cannot be preempted, so HFP/SCO is not disabled outright The guard is off by default and leaves every existing input-lock path untouched while disabled. Selection rules are covered by unit tests.
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.
What this does
Adds an opt-in "Bluetooth Audio Quality" guard that keeps the default input on the built-in microphone, so AirPods stay on the A2DP link instead of falling back to HFP/SCO (which roughly halves output quality and burns headset battery).
When enabled:
Off by default. When disabled, none of the existing input-lock paths change behaviour.
Why the existing input lock doesn't cover this
Lock Input Device(from #29) protects a user-chosen input and correctly steps aside for priority rules and deliberate changes (#428). That means:This PR adds a separate, stricter mode for the one case where the headset must never become the default input. It intentionally does not claim to disable HFP/SCO: macOS has no public API to make one device's input unavailable to other apps, so if a call app opens the headset mic directly, the guard can only report it.
Testing
BluetoothInputGuardPolicyTestscovers the selection rules: built-in preference, Bluetooth never chosen (even when it claimsbuiltIn), no built-in mic → no target, disabled → unrestricted, A2DP rates not flagged, SCO rates flagged, unknown rate not flagged.SwitchAudioSource/System Settings is reverted within ~1 s; after disabling the guard, the same switch sticks. Wake and reconnect paths behave the same.Notes
bluetoothInputProtection, defaultfalse, so users opt in.