From adc159eb05a5d15fb4df91231728e9e4c600a635 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 6 Jul 2022 02:20:05 -0700 Subject: [PATCH] [Playback] Prevent erroneous file from repeating Prevent Repeat Single from locking up the player on an unplayable file. Signed-off-by: Christopher Snowhill --- Audio/AudioPlayer.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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]; }