From 3b00232f74dd7f8e7a0ea578aa16b07f9cd32766 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Wed, 10 Oct 2018 20:01:32 +0300 Subject: [PATCH] - handle UA_EVENT_AUDIO_ERROR event - avoid possible crash at quit - upstream baresip updates --- app/build.gradle | 4 ++-- app/src/main/cpp/baresip.c | 3 +++ app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df989b41..fde1b81b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId = 'com.tutpro.baresip' minSdkVersion 21 targetSdkVersion 27 - versionCode = 22 - versionName = '3.0.1' + versionCode = 24 + versionName = '3.0.3' externalNativeBuild { cmake { cFlags '-DHAVE_INTTYPES_H' diff --git a/app/src/main/cpp/baresip.c b/app/src/main/cpp/baresip.c index 4ba1ca0c..e00276b2 100644 --- a/app/src/main/cpp/baresip.c +++ b/app/src/main/cpp/baresip.c @@ -145,6 +145,9 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev, case UA_EVENT_MWI_NOTIFY: re_snprintf(event_buf, sizeof event_buf, "mwi notify,%s", prm); break; + case UA_EVENT_AUDIO_ERROR: + mem_deref(call); + return; case UA_EVENT_EXIT: re_snprintf(event_buf, sizeof event_buf, "%s", "exit"); break; diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 38c95977..e61104b3 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -457,7 +457,11 @@ class BaresipService: Service() { MainActivity.images.clear() MainActivity.history.clear() MainActivity.messages.clear() - unregisterReceiver(nr) + try { + unregisterReceiver(nr) + } catch (e: Exception) { + Log.d(LOG_TAG, "Receiver nr has not been registered") + } nm.cancelAll() if (wl.isHeld) wl.release() if (fl.isHeld) fl.release()