Cog Audio: Only declare end of stream on read when previous node has declared end of stream and the buffer has actually run empty. This prevents the case where the buffer may terminate early due to the read pointer hitting the end of the ring buffer and wrapping.
parent
ec7ac74fcd
commit
d1b519d59d
|
@ -96,17 +96,16 @@
|
||||||
void *readPtr;
|
void *readPtr;
|
||||||
int amountToCopy;
|
int amountToCopy;
|
||||||
int availInput;
|
int availInput;
|
||||||
|
|
||||||
|
if ([[previousNode buffer] isEmpty] && [previousNode endOfStream] == YES)
|
||||||
|
{
|
||||||
|
endOfStream = YES;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
[readLock lock];
|
[readLock lock];
|
||||||
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
|
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
|
||||||
|
|
||||||
if (availInput < amount && [previousNode endOfStream] == YES)
|
|
||||||
{
|
|
||||||
// [previousNode release];
|
|
||||||
//If it is the outputNode, [soundController newInputChain];
|
|
||||||
//else
|
|
||||||
endOfStream = YES;
|
|
||||||
}
|
|
||||||
/* if (availInput <= 0) {
|
/* if (availInput <= 0) {
|
||||||
DLog(@"BUFFER RAN DRY!");
|
DLog(@"BUFFER RAN DRY!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue