From 2de42e0cde320bc785df6a123584c9953a83c885 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Wed, 29 Jan 2025 23:03:27 +0200 Subject: [PATCH] Added sleep before closing test audio stream Removed comment --- app/src/main/cpp/baresip.c | 4 ++++ app/src/main/kotlin/com/tutpro/baresip/Utils.kt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/baresip.c b/app/src/main/cpp/baresip.c index e62c3947..1c35e3c0 100644 --- a/app/src/main/cpp/baresip.c +++ b/app/src/main/cpp/baresip.c @@ -1826,6 +1826,10 @@ Java_com_tutpro_baresip_Api_create_1AAudio_1SessionId(JNIEnv *env, jobject obj) if (AAudioStreamBuilder_openStream(builder, &stream) == AAUDIO_OK) { sessionId = AAudioStream_getSessionId(stream); + struct timespec td = { + .tv_nsec = 100*1000*1000 /* 100ms */ + }; + nanosleep(&td, NULL); AAudioStream_close(stream); } diff --git a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt index d669ae85..309eae55 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt @@ -1062,7 +1062,7 @@ object Utils { val aec = AcousticEchoCanceler.create(sessionId) return if (aec != null) { - aec.release() // Clean up the AEC instance + aec.release() Log.i(TAG, "Hardware AEC is supported") true } else {