Rubber Band DSP: Fix error checking for output
The samples available function returns a signed integer, so it can apparently return negative on error, and the DSP was incorrectly casting this to an unsigned type, and thus attempting to buffer an inordinate number of samples and crashing. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
2ba8ec04a2
commit
94fcb68563
1 changed files with 2 additions and 2 deletions
|
@ -441,7 +441,7 @@ static void * kDSPRubberbandNodeContext = &kDSPRubberbandNodeContext;
|
||||||
|
|
||||||
rubberband_process(ts, (const float * const *)rsPtrs, len, endOfStream);
|
rubberband_process(ts, (const float * const *)rsPtrs, len, endOfStream);
|
||||||
|
|
||||||
size_t samplesAvailable;
|
ssize_t samplesAvailable;
|
||||||
if(!stopping && (samplesAvailable = rubberband_available(ts)) > 0) {
|
if(!stopping && (samplesAvailable = rubberband_available(ts)) > 0) {
|
||||||
while(!stopping && samplesAvailable > 0) {
|
while(!stopping && samplesAvailable > 0) {
|
||||||
if(toDrop > 0) {
|
if(toDrop > 0) {
|
||||||
|
@ -492,7 +492,7 @@ static void * kDSPRubberbandNodeContext = &kDSPRubberbandNodeContext;
|
||||||
if([chunk isHDCD]) [outputChunk setHDCD];
|
if([chunk isHDCD]) [outputChunk setHDCD];
|
||||||
[outputChunk setStreamTimestamp:streamTimestamp];
|
[outputChunk setStreamTimestamp:streamTimestamp];
|
||||||
[outputChunk setStreamTimeRatio:[chunk streamTimeRatio] * tempo];
|
[outputChunk setStreamTimeRatio:[chunk streamTimeRatio] * tempo];
|
||||||
[outputChunk assignSamples:rsOutBuffer frameCount:samplesBuffered];
|
[outputChunk assignSamples:&rsOutBuffer[0] frameCount:samplesBuffered];
|
||||||
samplesBuffered = 0;
|
samplesBuffered = 0;
|
||||||
stretchOut += [outputChunk duration];
|
stretchOut += [outputChunk duration];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue