r587 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Feb 26 13:47:39 EST 2006


Author: tma
Date: 2006-02-26 13:47:39 -0500 (Sun, 26 Feb 2006)
New Revision: 587

Modified:
   trunk/code/client/snd_codec_ogg.c
   trunk/code/client/snd_openal.c
Log:
* Sound related bug fixes from Thilo Schulz


Modified: trunk/code/client/snd_codec_ogg.c
===================================================================
--- trunk/code/client/snd_codec_ogg.c	2006-02-26 18:44:15 UTC (rev 586)
+++ trunk/code/client/snd_codec_ogg.c	2006-02-26 18:47:39 UTC (rev 587)
@@ -412,7 +412,7 @@
 void *S_OGG_CodecLoad(const char *filename, snd_info_t *info)
 {
 	snd_stream_t *stream;
-	unsigned char *buffer;
+	byte *buffer;
 	int bytesRead;
 	
 	// check if input is valid
@@ -452,8 +452,9 @@
 	// we don't even have read a single byte
 	if(bytesRead <= 0)
 	{
+		Z_Free(buffer);
 		S_OGG_CodecCloseStream(stream);
-	
+
 		return NULL;	
 	}
 

Modified: trunk/code/client/snd_openal.c
===================================================================
--- trunk/code/client/snd_openal.c	2006-02-26 18:44:15 UTC (rev 586)
+++ trunk/code/client/snd_openal.c	2006-02-26 18:47:39 UTC (rev 587)
@@ -1377,7 +1377,23 @@
 	
 	// Queue the musicBuffers up
 	for(i = 0; i < NUM_MUSIC_BUFFERS; i++)
+	{
 		S_AL_MusicProcess(musicBuffers[i]);
+
+		// check whether our stream still exists.
+		if(!mus_stream)
+		{
+			// there was an error in reading which resulted in a
+			// closed stream. We must bail out or we'll crash.
+
+			// deallocate everything we allocated so far:
+			qalDeleteBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
+			S_AL_MusicSourceFree();
+
+			return;
+		}
+	}
+
 	qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
 
 	// Set the initial gain property




More information about the quake3-commits mailing list