Audio queue: Better handle queues of lots of short files
This commit is contained in:
parent
00f1e0957c
commit
44b813d2bf
1 changed files with 19 additions and 4 deletions
|
@ -236,6 +236,8 @@
|
||||||
|
|
||||||
- (BOOL)endOfInputReached:(BufferChain *)sender //Sender is a BufferChain
|
- (BOOL)endOfInputReached:(BufferChain *)sender //Sender is a BufferChain
|
||||||
{
|
{
|
||||||
|
unsigned long queueCount = 0;
|
||||||
|
|
||||||
@synchronized (chainQueue) {
|
@synchronized (chainQueue) {
|
||||||
// No point in constructing new chain for the next playlist entry
|
// No point in constructing new chain for the next playlist entry
|
||||||
// if there's already one at the head of chainQueue... r-r-right?
|
// if there's already one at the head of chainQueue... r-r-right?
|
||||||
|
@ -247,11 +249,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([chainQueue count] >= 5)
|
// We don't want to do this, it may happen with a lot of short files
|
||||||
{
|
//if ([chainQueue count] >= 5)
|
||||||
return YES;
|
//{
|
||||||
}
|
// return YES;
|
||||||
|
//}
|
||||||
|
|
||||||
|
queueCount = [chainQueue count];
|
||||||
|
}
|
||||||
|
|
||||||
|
while (queueCount >= 5)
|
||||||
|
{
|
||||||
|
usleep(2000);
|
||||||
|
@synchronized (chainQueue) {
|
||||||
|
queueCount = [chainQueue count];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@synchronized (chainQueue) {
|
||||||
BufferChain *newChain = nil;
|
BufferChain *newChain = nil;
|
||||||
|
|
||||||
nextStreamUserInfo = [sender userInfo];
|
nextStreamUserInfo = [sender userInfo];
|
||||||
|
|
Loading…
Reference in a new issue