Work around rounding error with resampler flush
Resampler flush may indefinitely produce 1 sample if there is a rounding error with the buffering calculations. Work around this. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
3d24168ba7
commit
09aa0d96e1
1 changed files with 3 additions and 3 deletions
|
@ -169,7 +169,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
|||
[currentPtsLock lock];
|
||||
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
||||
[currentPtsLock unlock];
|
||||
if(samplesFlushed) {
|
||||
if(samplesFlushed > 1) {
|
||||
[visController postVisPCM:visTemp amount:samplesFlushed];
|
||||
} else {
|
||||
break;
|
||||
|
@ -207,7 +207,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
|||
[currentPtsLock lock];
|
||||
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
||||
[currentPtsLock unlock];
|
||||
if(samplesFlushed) {
|
||||
if(samplesFlushed > 1) {
|
||||
[visController postVisPCM:visTemp amount:samplesFlushed];
|
||||
} else {
|
||||
break;
|
||||
|
@ -806,7 +806,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
[currentPtsLock lock];
|
||||
samplesRendered = rsstate_flush(rsold, &rsTempBuffer[0], 4096);
|
||||
[currentPtsLock unlock];
|
||||
if(!samplesRendered) {
|
||||
if(samplesRendered < 4096) {
|
||||
rsstate_delete(rsold);
|
||||
rsold = NULL;
|
||||
rsDone = YES;
|
||||
|
|
Loading…
Reference in a new issue