1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Ensured that queue is not touched at all outside of the critical section.

This commit is contained in:
Thomas Harte 2017-03-11 18:17:09 -05:00
parent f0d944847b
commit b193248056

View File

@ -51,14 +51,15 @@ static void audioOutputCallback(
{
// Pull the delegate call for audio queue running dry outside of the locked region, to allow non-deadlocking
// lifecycle -dealloc events to result from it.
CSAudioQueue *queue = (__bridge CSAudioQueue *)inUserData;
BOOL isRunningDry = NO;
if([CSAudioQueueDeallocLock tryLock])
{
CSAudioQueue *queue = (__bridge CSAudioQueue *)inUserData;
BOOL isRunningDry = NO;
isRunningDry = [queue audioQueue:inAQ didCallbackWithBuffer:inBuffer];
id<CSAudioQueueDelegate> delegate = queue.delegate;
[CSAudioQueueDeallocLock unlock];
if(isRunningDry) [delegate audioQueueIsRunningDry:queue];
}
if(isRunningDry) [queue.delegate audioQueueIsRunningDry:queue];
}
#pragma mark - Standard object lifecycle