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.

CQTexperiment
Christopher Snowhill 2022-01-12 23:15:23 -08:00
parent ec7ac74fcd
commit d1b519d59d
1 changed files with 6 additions and 7 deletions

View File

@ -96,17 +96,16 @@
void *readPtr;
int amountToCopy;
int availInput;
if ([[previousNode buffer] isEmpty] && [previousNode endOfStream] == YES)
{
endOfStream = YES;
return 0;
}
[readLock lock];
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) {
DLog(@"BUFFER RAN DRY!");
}