diff options
author | Tim Angus <tim@ngus.net> | 2006-02-26 19:21:34 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2006-02-26 19:21:34 +0000 |
commit | 310effbb68b3e335574b682bb4359d8e29f3430b (patch) | |
tree | a4760bd05975904f114a3fb47fff139ad623c049 /src/client | |
parent | a59e1bf12d2fe0091eeb3ef3df8ce5a82baa1c8b (diff) |
* Merged ioq3-r587
- Symlink following stuff
- Sound fixes
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/snd_codec_ogg.c | 5 | ||||
-rw-r--r-- | src/client/snd_openal.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/client/snd_codec_ogg.c b/src/client/snd_codec_ogg.c index 464d8d38..9c17c0b9 100644 --- a/src/client/snd_codec_ogg.c +++ b/src/client/snd_codec_ogg.c @@ -412,7 +412,7 @@ where we read the whole stream at once. 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 @@ void *S_OGG_CodecLoad(const char *filename, snd_info_t *info) // we don't even have read a single byte if(bytesRead <= 0) { + Z_Free(buffer); S_OGG_CodecCloseStream(stream); - + return NULL; } diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 699db246..fa1aaad0 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -1378,7 +1378,23 @@ void S_AL_StartBackgroundTrack( const char *intro, const char *loop ) // 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 |