Commit 457969d
Remove blocking mic permission request from AudioEngine pre-enable check (#265)
Forward-port of #204 (originally targeting `m137_release`) to
`m144_release`, which is the line currently shipped by the LiveKit Swift
SDK (`main` pins `144.7559.10`). The blocking call was never ported
forward, so it still lives on `m144_release`.
## Problem
`EnsureMicrophonePermissionSync()` blocks the WebRTC worker thread on a
semaphore (`dispatch_semaphore_wait(…, DISPATCH_TIME_FOREVER)`) until
the user answers the mic permission dialog. When the app is woken in the
background (e.g. an incoming CallKit call), no dialog can appear, so
`setEngineAvailability` hangs indefinitely.
Ref: livekit/client-sdk-swift#815
## Change
Replace the blocking request with a passive
`IsMicrophonePermissionAuthorized()` check in the AudioEngine pre-enable
path. When the mic is not authorized it returns
`kAudioEngineErrorInsufficientDevicePermission` instead of blocking. The
(dead) `IsMicrophonePermissionGranted()` is renamed into that check; it
had no other callers.
Only the `.notDetermined` case changes behavior: previously it prompted
and blocked the worker thread; now it returns an error immediately.
`authorized` and `denied`/`restricted` are unchanged.1 parent eaf1cd8 commit 457969d
2 files changed
Lines changed: 6 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
516 | | - | |
| 515 | + | |
517 | 516 | | |
518 | 517 | | |
519 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2284 | 2284 | | |
2285 | 2285 | | |
2286 | 2286 | | |
2287 | | - | |
2288 | | - | |
2289 | | - | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
2290 | 2291 | | |
2291 | 2292 | | |
2292 | 2293 | | |
| |||
3185 | 3186 | | |
3186 | 3187 | | |
3187 | 3188 | | |
3188 | | - | |
| 3189 | + | |
3189 | 3190 | | |
3190 | 3191 | | |
3191 | 3192 | | |
3192 | 3193 | | |
3193 | | - | |
3194 | | - | |
3195 | | - | |
3196 | | - | |
3197 | | - | |
3198 | | - | |
3199 | | - | |
3200 | | - | |
3201 | | - | |
3202 | | - | |
3203 | | - | |
3204 | | - | |
3205 | | - | |
3206 | | - | |
3207 | | - | |
3208 | | - | |
3209 | | - | |
3210 | | - | |
3211 | | - | |
3212 | | - | |
3213 | | - | |
3214 | | - | |
3215 | | - | |
3216 | | - | |
3217 | | - | |
3218 | | - | |
3219 | | - | |
3220 | 3194 | | |
3221 | 3195 | | |
3222 | 3196 | | |
| |||
0 commit comments