Commit 06ba0c0
committed
oto: run Suspend/Resume off the calling thread on darwin
Suspend and Resume held c.cond.L to flip the toPause/toResume flags. On
iOS the audio render goroutine can hold c.cond.L for several seconds
while resume() retries transient AVAudioSession errors (e.g.
AVAudioSessionErrorCodeCannotStartPlaying), which meant the platform UI
thread could block in applicationWillResignActive / applicationDidBecome
Active for the duration of those retries.
Spawn a small goroutine to perform the cond.L acquisition and flag flip
so the caller returns immediately. The underlying audio loop, retry
policy, and error semantics are unchanged; errors from the asynchronous
transition still surface via Err on the next poll.
Updates #931 parent a70e54a commit 06ba0c0
1 file changed
Lines changed: 26 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
257 | 262 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
268 | 272 | | |
269 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
270 | 277 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
281 | 287 | | |
282 | 288 | | |
283 | 289 | | |
| |||
0 commit comments