used new audio_started() api function to make sure that audio is

started/stopped before trying to stop/start it
This commit is contained in:
Juha Heinanen
2018-10-24 15:58:07 +03:00
parent 6bc1cc0841
commit 7aa12e2ae6
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -8,8 +8,8 @@ android {
applicationId = 'com.tutpro.baresip' applicationId = 'com.tutpro.baresip'
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 27 targetSdkVersion 27
versionCode = 27 versionCode = 28
versionName = '3.1.0' versionName = '3.1.1'
externalNativeBuild { externalNativeBuild {
cmake { cmake {
cFlags '-DHAVE_INTTYPES_H' cFlags '-DHAVE_INTTYPES_H'
+4 -2
View File
@@ -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); struct call *call = (struct call *)strtoul(native_call, NULL, 10);
LOGD("starting audio of call %s\n", native_call); LOGD("starting audio of call %s\n", native_call);
re_thread_enter(); re_thread_enter();
audio_start(call_audio(call)); struct audio *a = call_audio(call);
if (!audio_started(a)) audio_start(a);
re_thread_leave(); re_thread_leave();
(*env)->ReleaseStringUTFChars(env, javaCall, native_call); (*env)->ReleaseStringUTFChars(env, javaCall, native_call);
return; 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); struct call *call = (struct call *)strtoul(native_call, NULL, 10);
LOGD("stopping audio of call %s\n", native_call); LOGD("stopping audio of call %s\n", native_call);
re_thread_enter(); re_thread_enter();
audio_stop(call_audio(call)); struct audio *a = call_audio(call);
if (audio_started(a)) audio_stop(a);
re_thread_leave(); re_thread_leave();
(*env)->ReleaseStringUTFChars(env, javaCall, native_call); (*env)->ReleaseStringUTFChars(env, javaCall, native_call);
return; return;