diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index 124a874..0d36eca 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -1030,7 +1030,7 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ framesPerPacket = currentlyReadingEntry->audioStreamBasicDescription.mFramesPerPacket; } - if (currentlyReadingEntry->processedPacketsCount * framesPerPacket < currentlyReadingEntry->audioStreamBasicDescription.mSampleRate * 15 * currentlyReadingEntry->audioStreamBasicDescription.mChannelsPerFrame) + if (currentlyReadingEntry->processedPacketsCount * framesPerPacket < currentlyReadingEntry->audioStreamBasicDescription.mSampleRate * 10 * currentlyReadingEntry->audioStreamBasicDescription.mChannelsPerFrame) { OSAtomicAdd32((int32_t)packetSize, ¤tlyReadingEntry->processedPacketsSizeTotal); OSAtomicIncrement32(¤tlyReadingEntry->processedPacketsCount); @@ -1885,6 +1885,11 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ return 0; } + if (self.internalState == AudioPlayerInternalStateStopped) + { + return 0; + } + OSSpinLockLock(¤tEntryReferencesLock); STKQueueEntry* entry = currentlyPlayingEntry; @@ -1917,6 +1922,11 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ return requestedSeekTime; } + if (self.internalState == AudioPlayerInternalStateStopped) + { + return 0; + } + if (newFileToPlay) { return 0; @@ -2842,8 +2852,6 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ currentlyReadingEntry.lastFrameIndex = self->framesQueued; currentlyReadingEntry.lastByteIndex = audioPacketsReadCount; - LOGINFO(([NSString stringWithFormat:@"eof2: %lld %lld %d", audioPacketsReadCount, audioPacketsPlayedCount, numberOfBuffersUsed])); - if (numberOfBuffersUsed == 0 && currentlyReadingEntry == currentlyPlayingEntry) { seekToTimeWasRequested = NO;