Fixed progress not correct when skipping a new track and the new track takes a while to buffer
This commit is contained in:
parent
5b629665d6
commit
ba8b29d106
|
|
@ -1954,7 +1954,7 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
{
|
||||
if (audioQueue)
|
||||
{
|
||||
[self resetAudioQueueWithReason:@"from setCurrentlyReadingEntry"];
|
||||
[self resetAudioQueueWithReason:@"from setCurrentlyReadingEntry" andPause:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2498,7 +2498,13 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
self.internalState = AudioPlayerInternalStateStopped;
|
||||
}
|
||||
|
||||
|
||||
-(void) resetAudioQueueWithReason:(NSString*)reason
|
||||
{
|
||||
[self resetAudioQueueWithReason:reason andPause:NO];
|
||||
}
|
||||
|
||||
-(void) resetAudioQueueWithReason:(NSString*)reason andPause:(BOOL)pause
|
||||
{
|
||||
OSStatus error;
|
||||
|
||||
|
|
@ -2510,13 +2516,16 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
|
||||
if (audioQueue)
|
||||
{
|
||||
error = AudioQueueReset(audioQueue);
|
||||
|
||||
OSSpinLockLock(¤tEntryReferencesLock);
|
||||
|
||||
AudioTimeStamp timeStamp;
|
||||
Boolean outTimelineDiscontinuity;
|
||||
|
||||
error = AudioQueueReset(audioQueue);
|
||||
|
||||
if (pause)
|
||||
{
|
||||
AudioQueuePause(audioQueue);
|
||||
}
|
||||
|
||||
AudioQueueGetCurrentTime(audioQueue, NULL, &timeStamp, &outTimelineDiscontinuity);
|
||||
|
||||
timelineAdjust = timeStamp.mSampleTime;
|
||||
|
|
@ -2529,9 +2538,7 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
rebufferingStartFrames = 0;
|
||||
}
|
||||
|
||||
OSSpinLockUnlock(¤tEntryReferencesLock);
|
||||
|
||||
if (startAudioQueue)
|
||||
if (!pause && startAudioQueue)
|
||||
{
|
||||
[self startAudioQueue];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue