1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-09 08:33:04 +00:00

Merge pull request #1444 from TomHarte/AudioQueueTransients

Treat kAudioQueueErr_CannotStart as ephemeral.
This commit is contained in:
Thomas Harte 2025-01-04 22:39:56 -05:00 committed by GitHub
commit 83a8c7215a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -185,7 +185,15 @@ static const int NumBuffers = MaximumBacklog + 1;
// Starting is a no-op if the queue is already playing, but it may not have been started
// yet, or may have been paused due to a pipeline failure if the producer is running slowly.
if(enqueuedBuffers > 1) {
OSSGuard(^{return AudioQueueStart(self->_audioQueue, NULL);});
OSSGuard(^{
const OSStatus result = AudioQueueStart(self->_audioQueue, NULL);
if(result == kAudioQueueErr_CannotStart) {
// Accept cannot-start, hoping it's ephemeral; Apple's specific advice is:
// "Sleeping briefly and retrying is recommended".
return kAudioSessionNoError;
}
return result;
});
}
[_queueLock unlock];
}