[Audio Player] Eliminate an avenue of lockups
Prevent the player from locking up in certain circumstances, by not locking chainQueue the entire time this function is processing. Signed-off-by: Christopher Snowhill <kode54@gmail.com>lastfm
parent
42b2142ab7
commit
22cd16bb46
|
@ -357,15 +357,18 @@
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferChain *lastChain;
|
||||||
|
|
||||||
@synchronized(chainQueue) {
|
@synchronized(chainQueue) {
|
||||||
newChain = [[BufferChain alloc] initWithController:self];
|
newChain = [[BufferChain alloc] initWithController:self];
|
||||||
|
|
||||||
endOfInputReached = YES;
|
endOfInputReached = YES;
|
||||||
|
|
||||||
BufferChain *lastChain = [chainQueue lastObject];
|
lastChain = [chainQueue lastObject];
|
||||||
if(lastChain == nil) {
|
if(lastChain == nil) {
|
||||||
lastChain = bufferChain;
|
lastChain = bufferChain;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL pathsEqual = NO;
|
BOOL pathsEqual = NO;
|
||||||
|
|
||||||
|
@ -381,7 +384,9 @@
|
||||||
if([lastChain setTrack:nextStream] && [newChain openWithInput:[lastChain inputNode] withUserInfo:nextStreamUserInfo withRGInfo:nextStreamRGInfo]) {
|
if([lastChain setTrack:nextStream] && [newChain openWithInput:[lastChain inputNode] withUserInfo:nextStreamUserInfo withRGInfo:nextStreamRGInfo]) {
|
||||||
[newChain setStreamURL:nextStream];
|
[newChain setStreamURL:nextStream];
|
||||||
|
|
||||||
|
@synchronized(chainQueue) {
|
||||||
[self addChainToQueue:newChain];
|
[self addChainToQueue:newChain];
|
||||||
|
}
|
||||||
DLog(@"TRACK SET!!! %@", newChain);
|
DLog(@"TRACK SET!!! %@", newChain);
|
||||||
// Keep on-playin
|
// Keep on-playin
|
||||||
newChain = nil;
|
newChain = nil;
|
||||||
|
@ -406,7 +411,9 @@
|
||||||
newChain = [[BufferChain alloc] initWithController:self];
|
newChain = [[BufferChain alloc] initWithController:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@synchronized(chainQueue) {
|
||||||
[self addChainToQueue:newChain];
|
[self addChainToQueue:newChain];
|
||||||
|
}
|
||||||
|
|
||||||
newChain = nil;
|
newChain = nil;
|
||||||
|
|
||||||
|
@ -420,7 +427,6 @@
|
||||||
// - self.nextStream == next playlist entry's URL
|
// - self.nextStream == next playlist entry's URL
|
||||||
// - self.nextStreamUserInfo == next playlist entry
|
// - self.nextStreamUserInfo == next playlist entry
|
||||||
// - head of chainQueue is the buffer chain for the next entry (which has launched its threads already)
|
// - head of chainQueue is the buffer chain for the next entry (which has launched its threads already)
|
||||||
}
|
|
||||||
|
|
||||||
atomic_fetch_sub(&refCount, 1);
|
atomic_fetch_sub(&refCount, 1);
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Reference in New Issue