diff options
author | Chris Robinson <[email protected]> | 2015-08-13 16:01:31 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-08-13 16:01:31 -0700 |
commit | 7d4e3688e1101ade56bb0769dcb28686dbc4d6e4 (patch) | |
tree | 4d90e012cac042b6fef6f0522f9664ff0680e572 /Alc | |
parent | f134fbac5cca8a91a84e4890b14d09f66089d862 (diff) |
Wait for the OpenSL buffer queue to empty when stopping
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/opensl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index 1043359c..7b8fdb25 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -25,7 +25,7 @@ #include "alMain.h" #include "alu.h" - +#include "threads.h" #include <SLES/OpenSLES.h> #include <SLES/OpenSLES_Android.h> @@ -379,6 +379,15 @@ static void opensl_stop_playback(ALCdevice *Device) result = VCALL0(bufferQueue,Clear)(); PRINTERR(result, "bufferQueue->Clear"); } + if(SL_RESULT_SUCCESS == result) + { + SLAndroidSimpleBufferQueueState state; + do { + althrd_yield(); + result = VCALL(bufferQueue,GetState)(&state); + } while(SL_RESULT_SUCCESS == result && state.count > 0); + PRINTERR(result, "bufferQueue->GetState"); + } free(data->buffer); data->buffer = NULL; |