fix(macos): guard voice audio paths with no input device (#25817)

Co-authored-by: Stefan Förster <103369858+sfo2001@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-25 00:09:57 +00:00
parent e11e510f5b
commit 236b22b6a2
8 changed files with 68 additions and 0 deletions

View File

@@ -53,6 +53,15 @@ final class AudioInputDeviceObserver {
return output
}
/// Returns true when the system default input device exists and is alive with input channels.
/// Use this preflight before accessing `AVAudioEngine.inputNode` to avoid SIGABRT on Macs
/// without a built-in microphone (Mac mini, Mac Pro, Mac Studio) or when an external mic
/// is disconnected.
static func hasUsableDefaultInputDevice() -> Bool {
guard let uid = self.defaultInputDeviceUID() else { return false }
return self.aliveInputDeviceUIDs().contains(uid)
}
static func defaultInputDeviceSummary() -> String {
let systemObject = AudioObjectID(kAudioObjectSystemObject)
var address = AudioObjectPropertyAddress(