Audio Output: Fix converter to always emit trailing samples on end of track

CQTexperiment
Christopher Snowhill 2021-12-27 17:04:16 -08:00
parent 8e895c88c0
commit 25a43a9083
1 changed files with 7 additions and 1 deletions

View File

@ -282,7 +282,7 @@ static OSStatus ACFloatProc(AudioConverterRef inAudioConverter,
convertEntered = YES; convertEntered = YES;
tryagain2: tryagain2:
if (stopping || [self shouldContinue] == NO || [self endOfStream] == YES) if (stopping || [self shouldContinue] == NO)
{ {
convertEntered = NO; convertEntered = NO;
return amountRead; return amountRead;
@ -376,6 +376,12 @@ tryagain2:
amountRead += ioNumberPackets * outputFormat.mBytesPerPacket; amountRead += ioNumberPackets * outputFormat.mBytesPerPacket;
if (err == 100) if (err == 100)
{ {
if ([self endOfStream] == YES)
{
convertEntered = NO;
return amountRead;
}
goto tryagain2; goto tryagain2;
} }
else if (err != noErr && err != kAudioConverterErr_InvalidInputSize) else if (err != noErr && err != kAudioConverterErr_InvalidInputSize)