prevent division by zero
This commit is contained in:
parent
57bea6d964
commit
8f2e2ec7b2
|
@ -27,11 +27,15 @@ void taSDLProcess(void* inst, unsigned char* buf, int nframes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAAudioSDL::onProcess(unsigned char* buf, int nframes) {
|
void TAAudioSDL::onProcess(unsigned char* buf, int nframes) {
|
||||||
unsigned int unframes=nframes/(sizeof(float)*desc.outChans);
|
unsigned int unframes=nframes/(sizeof(float)*MAX(1,desc.outChans));
|
||||||
if (nframes<0) {
|
if (nframes<0) {
|
||||||
logE("nframes is negative! (%d)",nframes);
|
logE("nframes is negative! (%d)",nframes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (desc.outChans<1) {
|
||||||
|
logE("outChans is less than 1!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (int i=0; i<desc.inChans; i++) {
|
for (int i=0; i<desc.inChans; i++) {
|
||||||
if (unframes>desc.bufsize) {
|
if (unframes>desc.bufsize) {
|
||||||
delete[] inBufs[i];
|
delete[] inBufs[i];
|
||||||
|
|
Loading…
Reference in a new issue