From 7aa12e2ae6d424f91d5c3b20b14f8f6a48fbfc08 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Wed, 24 Oct 2018 15:58:07 +0300 Subject: [PATCH] used new audio_started() api function to make sure that audio is started/stopped before trying to stop/start it --- app/build.gradle | 4 ++-- app/src/main/cpp/baresip.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 682a6a26..38f7fd18 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId = 'com.tutpro.baresip' minSdkVersion 21 targetSdkVersion 27 - versionCode = 27 - versionName = '3.1.0' + versionCode = 28 + versionName = '3.1.1' externalNativeBuild { cmake { cFlags '-DHAVE_INTTYPES_H' diff --git a/app/src/main/cpp/baresip.c b/app/src/main/cpp/baresip.c index 9f845e54..0da4d3bd 100644 --- a/app/src/main/cpp/baresip.c +++ b/app/src/main/cpp/baresip.c @@ -951,7 +951,8 @@ Java_com_tutpro_baresip_MainActivity_call_1start_1audio(JNIEnv *env, jobject thi struct call *call = (struct call *)strtoul(native_call, NULL, 10); LOGD("starting audio of call %s\n", native_call); re_thread_enter(); - audio_start(call_audio(call)); + struct audio *a = call_audio(call); + if (!audio_started(a)) audio_start(a); re_thread_leave(); (*env)->ReleaseStringUTFChars(env, javaCall, native_call); return; @@ -963,7 +964,8 @@ Java_com_tutpro_baresip_MainActivity_call_1stop_1audio(JNIEnv *env, jobject thiz struct call *call = (struct call *)strtoul(native_call, NULL, 10); LOGD("stopping audio of call %s\n", native_call); re_thread_enter(); - audio_stop(call_audio(call)); + struct audio *a = call_audio(call); + if (audio_started(a)) audio_stop(a); re_thread_leave(); (*env)->ReleaseStringUTFChars(env, javaCall, native_call); return;