()
| 250 | } |
| 251 | |
| 252 | func (c *context) resume() error { |
| 253 | var retryCount int |
| 254 | try: |
| 255 | if osstatus := _AudioQueueStart(c.audioQueue, nil); osstatus != noErr { |
| 256 | if (osstatus == avAudioSessionErrorCodeCannotStartPlaying || |
| 257 | osstatus == avAudioSessionErrorCodeCannotInterruptOthers) && |
| 258 | retryCount < 30 { |
| 259 | // It is uncertain that this error is temporary or not. Then let's use exponential-time sleeping. |
| 260 | time.Sleep(sleepTime(retryCount)) |
| 261 | retryCount++ |
| 262 | goto try |
| 263 | } |
| 264 | if osstatus == avAudioSessionErrorCodeSiriIsRecording { |
| 265 | // As this error should be temporary, it should be OK to use a short time for sleep anytime. |
| 266 | time.Sleep(10 * time.Millisecond) |
| 267 | goto try |
| 268 | } |
| 269 | return fmt.Errorf("oto: AudioQueueStart failed at Resume: %d", osstatus) |
| 270 | } |
| 271 | return nil |
| 272 | } |
| 273 | |
| 274 | func (c *context) Err() error { |
| 275 | if err := c.err.Load(); err != nil { |
no test coverage detected