From 8d37864e2cd5f6d878ce44a95bba3b9fcc354098 Mon Sep 17 00:00:00 2001 From: tma Date: Sun, 15 Mar 2009 12:39:53 +0000 Subject: * Fix leaking OpenAL buffers (Amanieu) git-svn-id: svn://svn.icculus.org/quake3/trunk@1510 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/snd_openal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 6b3f547..b8ae488 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -1396,6 +1396,8 @@ S_AL_StreamDie static void S_AL_StreamDie( int stream ) { + int numBuffers; + if ((stream < 0) || (stream >= MAX_RAW_STREAMS)) return; @@ -1404,6 +1406,16 @@ void S_AL_StreamDie( int stream ) streamPlaying[stream] = qfalse; qalSourceStop(streamSources[stream]); + + // Un-queue any buffers, and delete them + qalGetSourcei( streamSources[stream], AL_BUFFERS_PROCESSED, &numBuffers ); + while( numBuffers-- ) + { + ALuint buffer; + qalSourceUnqueueBuffers(streamSources[stream], 1, &buffer); + qalDeleteBuffers(1, &buffer); + } + S_AL_FreeStreamChannel(stream); } -- cgit v1.2.3