From 16ed63107fe6a5284b457d86d7cdab019df29f32 Mon Sep 17 00:00:00 2001 From: paolo mac Date: Fri, 2 Feb 2024 17:32:14 +0100 Subject: [PATCH] ma_device_stop locks until audio worker ends. It's better called before freeing memory --- templates/android/src/jni.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/templates/android/src/jni.cpp b/templates/android/src/jni.cpp index 169ad63..510d4ad 100644 --- a/templates/android/src/jni.cpp +++ b/templates/android/src/jni.cpp @@ -267,14 +267,13 @@ JNIEXPORT void JNICALL JNI_FUNC(nativeAudioStop)(JNIEnv* env, jobject thiz) { (void)env; (void)thiz; - - if (mem != NULL) - free(mem); - plugin_fini(&instance); #if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0 ma_device_stop(&device); ma_device_uninit(&device); #endif + if (mem != NULL) + free(mem); + plugin_fini(&instance); } extern "C"