Fixed async AudioQueue stop method for determing if a queued item has finished not taking into account upcoming queued items that aren't being decoded because they're incompatible
This commit is contained in:
parent
c100cb7202
commit
b4948882e4
|
|
@ -246,6 +246,19 @@ AudioQueueBufferRefLookupEntry;
|
|||
}
|
||||
}
|
||||
|
||||
-(BOOL) couldBeIncompatible:(AudioStreamBasicDescription*)basicDescription
|
||||
{
|
||||
if (self->audioStreamBasicDescription.mSampleRate != 0)
|
||||
{
|
||||
if (memcmp(&(self->audioStreamBasicDescription), basicDescription, sizeof(*basicDescription)) != 0)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(NSString*) description
|
||||
{
|
||||
return [[self queueItemId] description];
|
||||
|
|
@ -1090,7 +1103,15 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
}
|
||||
}
|
||||
|
||||
if ([upcomingQueue peek] == nil && everythingInBufferingQueueBuffered)
|
||||
BOOL upcomingExistsAndIsIncompatible = NO;
|
||||
STKQueueEntry* upcoming = [upcomingQueue peek];
|
||||
|
||||
if (upcoming != nil)
|
||||
{
|
||||
upcomingExistsAndIsIncompatible = [upcoming couldBeIncompatible:¤tAudioStreamBasicDescription];
|
||||
}
|
||||
|
||||
if ((upcoming == nil || upcomingExistsAndIsIncompatible) && everythingInBufferingQueueBuffered)
|
||||
{
|
||||
if (self.internalState != AudioPlayerInternalStateFlushingAndStoppingButStillPlaying)
|
||||
{
|
||||
|
|
@ -1834,12 +1855,9 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
|
||||
if (next)
|
||||
{
|
||||
if (next->audioStreamBasicDescription.mSampleRate != 0)
|
||||
if ([next couldBeIncompatible:¤tAudioStreamBasicDescription])
|
||||
{
|
||||
if (memcmp(&next->audioStreamBasicDescription, ¤tAudioStreamBasicDescription, sizeof(currentAudioStreamBasicDescription)) != 0)
|
||||
{
|
||||
nextIsIncompatible = YES;
|
||||
}
|
||||
nextIsIncompatible = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue