diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index 9e32e2121..69911e317 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -90,6 +90,10 @@ [self requestNextStream:userInfo]; + if([nextStream isEqualTo:url]) { + return; + } + url = nextStream; if(url == nil) { return; @@ -398,7 +402,9 @@ lastChain = nil; - while(shouldContinue && ![newChain open:nextStream withUserInfo:nextStreamUserInfo withRGInfo:nextStreamRGInfo]) { + NSURL *url = nextStream; + + while(shouldContinue && ![newChain open:url withUserInfo:nextStreamUserInfo withRGInfo:nextStreamRGInfo]) { if(nextStream == nil) { newChain = nil; atomic_fetch_sub(&refCount, 1); @@ -408,6 +414,14 @@ newChain = nil; [self requestNextStream:nextStreamUserInfo]; + if([nextStream isEqualTo:url]) { + newChain = nil; + atomic_fetch_sub(&refCount, 1); + return YES; + } + + url = nextStream; + newChain = [[BufferChain alloc] initWithController:self]; }