Rearranged comparison to prevent underflow.
parent
d8df7afcbb
commit
876efcde38
|
@ -370,14 +370,14 @@ audio_linear_round(unsigned int bits,
|
|||
return;
|
||||
}
|
||||
|
||||
if (_framesDecoded + (sampleCount - startingSample) > totalFrames - _endPadding) {
|
||||
sampleCount = totalFrames - _endPadding - _framesDecoded + startingSample;
|
||||
if (_framesDecoded + sampleCount + _endPadding > totalFrames + startingSample ) {
|
||||
// NSLog(@"End of file. %li", totalFrames - _endPadding - _framesDecoded);
|
||||
sampleCount = totalFrames + startingSample - _endPadding - _framesDecoded;
|
||||
}
|
||||
|
||||
if (startingSample > sampleCount) {
|
||||
_framesDecoded += _synth.pcm.length;
|
||||
// NSLog(@"Skipping entire sample");
|
||||
_framesDecoded += _synth.pcm.length;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue