1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Defers starting the macOS audio queue, and attempts to restart it upon packet loss.

Hopefully forever to vanish permanent audio loss?
This commit is contained in:
Thomas Harte 2020-02-08 22:08:27 -05:00
parent c26c8992ae
commit dac217c98c

View File

@ -117,7 +117,6 @@ static void audioOutputCallback(
kCFRunLoopCommonModes, kCFRunLoopCommonModes,
0, 0,
&_audioQueue)) { &_audioQueue)) {
AudioQueueStart(_audioQueue, NULL);
} }
} }
@ -175,6 +174,10 @@ static void audioOutputCallback(
AudioQueueEnqueueBuffer(_audioQueue, newBuffer, 0, NULL); AudioQueueEnqueueBuffer(_audioQueue, newBuffer, 0, NULL);
[_storedBuffersLock unlock]; [_storedBuffersLock unlock];
// 'Start' the queue. This is documented to be a no-op if the queue is already started,
// and it's better to defer starting it until at least some data is available.
AudioQueueStart(_audioQueue, NULL);
} }
#pragma mark - Sampling Rate getters #pragma mark - Sampling Rate getters