From: molivier Date: Sun, 11 Apr 2004 17:34:51 +0000 (+0000) Subject: Added an error message when the sound mixer requests more samples from a stream than... X-Git-Tag: xonotic-v0.1.0preview~5927 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=511b27b0fbc65c9e74067fc32d707c6e84191d1e;p=xonotic%2Fdarkplaces.git Added an error message when the sound mixer requests more samples from a stream than its buffer can contain git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4093 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_ogg.c b/snd_ogg.c index 6c78a676..abfe3bc1 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -415,13 +415,20 @@ static const sfxbuffer_t* OGG_FetchSound (channel_t* ch, unsigned int start, uns } sb = &per_ch->sb; + factor = per_ch->format.width * per_ch->format.channels; + + // If the stream buffer can't contain that much samples anyway + if (nbsamples * factor > STREAM_BUFFER_SIZE) + { + Con_Printf ("OGG_FetchSound: stream buffer too small (%u bytes required)\n", nbsamples * factor); + return NULL; + } // If the data we need has already been decompressed in the sfxbuffer, just return it if (sb->offset <= start && sb->offset + sb->length >= start + nbsamples) return sb; newlength = sb->offset + sb->length - start; - factor = per_ch->format.width * per_ch->format.channels; // If we need to skip some data before decompressing the rest, or if the stream has looped if (newlength < 0 || sb->offset > start)