diff --git a/Audjustable/Classes/AudioPlayer/AudioPlayer.m b/Audjustable/Classes/AudioPlayer/AudioPlayer.m index 49bdce7..1c5c090 100644 --- a/Audjustable/Classes/AudioPlayer/AudioPlayer.m +++ b/Audjustable/Classes/AudioPlayer/AudioPlayer.m @@ -213,7 +213,7 @@ double calculatedBitRate = [self calculatedBitRate]; - if (calculatedBitRate == 0 || self->dataSource.length == 0) + if (calculatedBitRate == 0 || dataSource.length == 0) { return 0; } @@ -1220,20 +1220,20 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ return 0; } - pthread_mutex_lock(&playerMutex); + OSSpinLockLock(¤tlyPlayingLock); QueueEntry* entry = currentlyPlayingEntry; if (entry == nil) { - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return 0; } double retval = [entry duration]; - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return retval; } @@ -1250,20 +1250,20 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ return 0; } - pthread_mutex_lock(&playerMutex); + OSSpinLockLock(¤tlyPlayingLock); QueueEntry* entry = currentlyPlayingEntry; if (entry == nil) { - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return 0; } double retval = [entry progress]; - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return retval; } @@ -2146,20 +2146,20 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ -(NSObject*) currentlyPlayingQueueItemId { - pthread_mutex_lock(&playerMutex); + OSSpinLockLock(¤tlyPlayingLock); QueueEntry* entry = currentlyPlayingEntry; if (entry == nil) { - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return nil; } NSObject* retval = entry.queueItemId; - pthread_mutex_unlock(&playerMutex); + OSSpinLockUnlock(¤tlyPlayingLock); return retval; }