Minor changes that may or may not have any impact on gaplessness
This commit is contained in:
parent
b9ce8462c4
commit
8c80981827
3 changed files with 12 additions and 9 deletions
|
@ -134,9 +134,15 @@
|
||||||
if (amountInBuffer < CHUNK_SIZE) {
|
if (amountInBuffer < CHUNK_SIZE) {
|
||||||
int framesToRead = (CHUNK_SIZE - amountInBuffer)/bytesPerFrame;
|
int framesToRead = (CHUNK_SIZE - amountInBuffer)/bytesPerFrame;
|
||||||
int framesRead = [decoder readAudio:((char *)inputBuffer) + amountInBuffer frames:framesToRead];
|
int framesRead = [decoder readAudio:((char *)inputBuffer) + amountInBuffer frames:framesToRead];
|
||||||
amountInBuffer += (framesRead * bytesPerFrame);
|
|
||||||
|
|
||||||
if (framesRead <= 0)
|
if (framesRead > 0)
|
||||||
|
{
|
||||||
|
amountInBuffer += (framesRead * bytesPerFrame);
|
||||||
|
[self writeData:inputBuffer amount:amountInBuffer];
|
||||||
|
amountInBuffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (framesRead < framesToRead)
|
||||||
{
|
{
|
||||||
if (initialBufferFilled == NO) {
|
if (initialBufferFilled == NO) {
|
||||||
[controller initialBufferFilled:self];
|
[controller initialBufferFilled:self];
|
||||||
|
@ -163,10 +169,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
[self writeData:inputBuffer amount:amountInBuffer];
|
|
||||||
amountInBuffer = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldClose)
|
if (shouldClose)
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
[readLock lock];
|
[readLock lock];
|
||||||
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
|
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
|
||||||
|
|
||||||
if (availInput <= amount && [previousNode endOfStream] == YES)
|
if (availInput < amount && [previousNode endOfStream] == YES)
|
||||||
{
|
{
|
||||||
// [previousNode release];
|
// [previousNode release];
|
||||||
//If it is the outputNode, [soundController newInputChain];
|
//If it is the outputNode, [soundController newInputChain];
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
[self setPreviousNode:[[controller bufferChain] finalNode]];
|
[self setPreviousNode:[[controller bufferChain] finalNode]];
|
||||||
|
|
||||||
n = [super readData:ptr amount:amount];
|
n = [super readData:ptr amount:amount];
|
||||||
|
amountPlayed += n;
|
||||||
|
|
||||||
if (endOfStream == YES)
|
if (endOfStream == YES)
|
||||||
{
|
{
|
||||||
amountPlayed = 0;
|
amountPlayed = 0;
|
||||||
|
@ -64,8 +66,6 @@
|
||||||
DLog(@"Output Buffer dry!");
|
DLog(@"Output Buffer dry!");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
amountPlayed += n;
|
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
Loading…
Reference in a new issue