From 1db932d8560db83e7d2b8147247269cbdf1b42ef Mon Sep 17 00:00:00 2001 From: Nevyn Bengtsson Date: Sun, 5 Jan 2020 21:26:14 +0100 Subject: [PATCH] Source: Stop, then unqueue buffers Doing it the other way around is illegal; you may not unqueue unprocessed buffers, so we need to stop first. --- src/modules/audio/source.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/audio/source.c b/src/modules/audio/source.c index 7575aadc..9671de13 100644 --- a/src/modules/audio/source.c +++ b/src/modules/audio/source.c @@ -281,15 +281,15 @@ void lovrSourceStop(Source* source) { case SOURCE_STREAM: { + // Stop the source + alSourceStop(source->id); + alSourcei(source->id, AL_BUFFER, AL_NONE); + // Empty the buffers int count = 0; alGetSourcei(source->id, AL_BUFFERS_QUEUED, &count); alSourceUnqueueBuffers(source->id, count, NULL); - // Stop the source - alSourceStop(source->id); - alSourcei(source->id, AL_BUFFER, AL_NONE); - // Rewind the decoder if (!lovrAudioStreamIsRaw(source->stream)) { lovrAudioStreamRewind(source->stream);