X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=snd_ogg.c;h=0ee16bab4bd7f70cfd64d7310b6b9ba8f72001d9;hb=refs%2Fheads%2Fakari%2Firc;hp=e383655a176f29bfb96f87453daaa2ca7770e333;hpb=4aa041287d27a50f7cbfd4628d80c118e1bfcade;p=xonotic%2Fdarkplaces.git diff --git a/snd_ogg.c b/snd_ogg.c index e383655a..0ee16bab 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -534,10 +534,11 @@ static const snd_buffer_t* OGG_FetchSound (void *sfxfetcher, void **chfetcherpoi // 1- to ensure we won't lose many samples during the resampling process // 2- to reduce calls to OGG_FetchSound to regulate workload newlength = (int)(per_sfx->format.speed*STREAM_BUFFER_FILL); - if (newlength + sb->nbframes > sb->maxframes) + // this is how much we FETCH... + if ((size_t) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed) + sb->nbframes > sb->maxframes) { Con_Printf ("OGG_FetchSound: stream buffer overflow (%u + %u = %u sample frames / %u)\n", - newlength, sb->nbframes, newlength + sb->nbframes, sb->maxframes); + (unsigned int) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed), sb->nbframes, (unsigned int) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed) + sb->nbframes, sb->maxframes); return NULL; } newlength *= factor; // convert from sample frames to bytes