Created a new internal state - AudioPlayerInternalStateRebuffering, it's mostly cosmetic so users of Audjustable are informed when playback pauses because the buffers have dried up
This commit is contained in:
parent
7abcc78b1e
commit
45e6edb28e
|
|
@ -49,8 +49,9 @@ typedef enum
|
|||
AudioPlayerInternalStatePlaying = (1 << 1) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateStartingThread = (1 << 2) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateWaitingForData = (1 << 3) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateWaitingForQueueToStart = (1 << 5) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStatePaused = (1 << 6) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateWaitingForQueueToStart = (1 << 4) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStatePaused = (1 << 5) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateRebuffering = (1 << 6) | AudioPlayerInternalStateRunning,
|
||||
AudioPlayerInternalStateStopping = (1 << 7),
|
||||
AudioPlayerInternalStateStopped = (1 << 8),
|
||||
AudioPlayerInternalStateDisposed = (1 << 9),
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
case AudioPlayerInternalStateWaitingForData:
|
||||
case AudioPlayerInternalStateWaitingForQueueToStart:
|
||||
case AudioPlayerInternalStatePlaying:
|
||||
case AudioPlayerInternalStateRebuffering:
|
||||
newState = AudioPlayerStatePlaying;
|
||||
break;
|
||||
case AudioPlayerInternalStateStopping:
|
||||
|
|
@ -872,6 +873,11 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
signal = YES;
|
||||
}
|
||||
|
||||
if (!audioQueueFlushing && [self progress] > 4.0 && numberOfBuffersUsed == 0 ) {
|
||||
self.internalState = AudioPlayerInternalStateRebuffering;
|
||||
}
|
||||
|
||||
|
||||
if (!audioQueueFlushing)
|
||||
{
|
||||
if (entry != nil)
|
||||
|
|
@ -1018,6 +1024,11 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
|
|||
}
|
||||
}
|
||||
|
||||
if (self.internalState == AudioPlayerInternalStateRebuffering && numberOfBuffersUsed >= AudioPlayerBuffersNeededToStart) {
|
||||
self.internalState =AudioPlayerInternalStatePlaying;
|
||||
}
|
||||
|
||||
|
||||
if (++fillBufferIndex >= audioQueueBufferCount)
|
||||
{
|
||||
fillBufferIndex = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue