X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=snd_ogg.c;h=0ee16bab4bd7f70cfd64d7310b6b9ba8f72001d9;hb=refs%2Fheads%2Fakari%2Firc;hp=c3143ac9ba6bf381ff7d77cca0c03aaca73c8f17;hpb=1099a9f1f9d2e4b30003c14eb42ce78c5958023d;p=xonotic%2Fdarkplaces.git diff --git a/snd_ogg.c b/snd_ogg.c index c3143ac9..0ee16bab 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -222,7 +222,7 @@ typedef struct static int (*qov_clear) (OggVorbis_File *vf); static vorbis_info* (*qov_info) (OggVorbis_File *vf,int link); static vorbis_comment* (*qov_comment) (OggVorbis_File *vf,int link); -static char * (*qvorbis_comment_query) (vorbis_comment *vc, char *tag, int count); +static char * (*qvorbis_comment_query) (vorbis_comment *vc, const char *tag, int count); static int (*qov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); @@ -274,6 +274,7 @@ qboolean OGG_OpenLibrary (void) const char* dllnames_vo [] = { #if defined(WIN32) + "libvorbis-0.dll", "libvorbis.dll", "vorbis.dll", #elif defined(MACOSX) @@ -287,6 +288,7 @@ qboolean OGG_OpenLibrary (void) const char* dllnames_vf [] = { #if defined(WIN32) + "libvorbisfile-3.dll", "libvorbisfile.dll", "vorbisfile.dll", #elif defined(MACOSX) @@ -532,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 sample frames / %u)\n", - sb->format.speed + sb->nbframes, sb->maxframes); + Con_Printf ("OGG_FetchSound: stream buffer overflow (%u + %u = %u sample frames / %u)\n", + (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