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
a6ecd7eed9
commit
3d00e8dd2d
1 changed files with 3 additions and 3 deletions
|
@ -169,7 +169,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
||||||
[currentPtsLock lock];
|
[currentPtsLock lock];
|
||||||
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
||||||
[currentPtsLock unlock];
|
[currentPtsLock unlock];
|
||||||
if(samplesFlushed) {
|
if(samplesFlushed > 1) {
|
||||||
[visController postVisPCM:visTemp amount:samplesFlushed];
|
[visController postVisPCM:visTemp amount:samplesFlushed];
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -207,7 +207,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
||||||
[currentPtsLock lock];
|
[currentPtsLock lock];
|
||||||
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192);
|
||||||
[currentPtsLock unlock];
|
[currentPtsLock unlock];
|
||||||
if(samplesFlushed) {
|
if(samplesFlushed > 1) {
|
||||||
[visController postVisPCM:visTemp amount:samplesFlushed];
|
[visController postVisPCM:visTemp amount:samplesFlushed];
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -806,7 +806,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
||||||
[currentPtsLock lock];
|
[currentPtsLock lock];
|
||||||
samplesRendered = rsstate_flush(rsold, &rsTempBuffer[0], 4096);
|
samplesRendered = rsstate_flush(rsold, &rsTempBuffer[0], 4096);
|
||||||
[currentPtsLock unlock];
|
[currentPtsLock unlock];
|
||||||
if(!samplesRendered) {
|
if(samplesRendered < 4096) {
|
||||||
rsstate_delete(rsold);
|
rsstate_delete(rsold);
|
||||||
rsold = NULL;
|
rsold = NULL;
|
||||||
rsDone = YES;
|
rsDone = YES;
|
||||||
|
|
Loading…
Reference in a new issue