Commit 2d30e846 authored by jehan's avatar jehan
Browse files

fix multicast lock crash + enable dtls for android

parent f98d1f4f
......@@ -1160,10 +1160,23 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
return nativePtr;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env, jobject thiz, jlong lc) {
jobject core = (jobject)linphone_core_get_user_data((LinphoneCore*)lc);
linphone_core_destroy((LinphoneCore*)lc);
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env, jobject thiz, jlong native_ptr) {
LinphoneCore *lc=(LinphoneCore*)native_ptr;
jobject core = (jobject)linphone_core_get_user_data(lc);
jobject multicast_lock = lc->multicast_lock;
jobject multicast_lock_class = lc->multicast_lock_class;
jobject wifi_lock = lc->wifi_lock;
jobject wifi_lock_class = lc->wifi_lock_class;
linphone_core_destroy(lc);
ms_exit();
if (wifi_lock) env->DeleteGlobalRef(wifi_lock);
if (wifi_lock_class) env->DeleteGlobalRef(wifi_lock_class);
if (multicast_lock) env->DeleteGlobalRef(multicast_lock);
if (multicast_lock_class) env->DeleteGlobalRef(multicast_lock_class);
if (core) {
env->DeleteGlobalRef(core);
}
......@@ -4082,33 +4095,43 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidPowerManager(J
#endif
}
/*released in Java_org_linphone_core_LinphoneCoreImpl_delete*/
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidWifiLock(JNIEnv *env, jobject thiz, jlong ptr, jobject wifi_lock) {
#ifdef ANDROID
LinphoneCore *lc=(LinphoneCore*)ptr;
if (lc->wifi_lock)
if (lc->wifi_lock) {
env->DeleteGlobalRef(lc->wifi_lock);
env->DeleteGlobalRef(lc->wifi_lock_class);
}
if (wifi_lock != NULL) {
lc->wifi_lock=env->NewGlobalRef(wifi_lock);
jclass wifiLockClass = env->FindClass("android/net/wifi/WifiManager$WifiLock");
lc->wifi_lock_acquire_id = env->GetMethodID(wifiLockClass, "acquire", "()V");
lc->wifi_lock_release_id = env->GetMethodID(wifiLockClass, "release", "()V");
lc->wifi_lock_class = env->FindClass("android/net/wifi/WifiManager$WifiLock");
lc->wifi_lock_class = (jclass)env->NewGlobalRef(lc->wifi_lock_class); /*to make sure methodid are preserved*/
lc->wifi_lock_acquire_id = env->GetMethodID(lc->wifi_lock_class, "acquire", "()V");
lc->wifi_lock_release_id = env->GetMethodID(lc->wifi_lock_class, "release", "()V");
} else {
lc->wifi_lock=NULL;
lc->wifi_lock_class=NULL;
}
#endif
}
/*released in Java_org_linphone_core_LinphoneCoreImpl_delete*/
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidMulticastLock(JNIEnv *env, jobject thiz, jlong ptr, jobject multicast_lock) {
#ifdef ANDROID
LinphoneCore *lc=(LinphoneCore*)ptr;
if (lc->multicast_lock)
if (lc->multicast_lock) {
env->DeleteGlobalRef(lc->multicast_lock);
env->DeleteGlobalRef(lc->multicast_lock_class);
}
if (multicast_lock != NULL) {
lc->multicast_lock=env->NewGlobalRef(multicast_lock);
jclass multicastLockClass = env->FindClass("android/net/wifi/WifiManager$MulticastLock");
lc->multicast_lock_acquire_id = env->GetMethodID(multicastLockClass, "acquire", "()V");
lc->multicast_lock_release_id = env->GetMethodID(multicastLockClass, "release", "()V");
lc->multicast_lock_class = env->FindClass("android/net/wifi/WifiManager$MulticastLock");
lc->multicast_lock_class = (jclass)env->NewGlobalRef(lc->multicast_lock_class);/*to make sure methodid are preserved*/
lc->multicast_lock_acquire_id = env->GetMethodID(lc->multicast_lock_class, "acquire", "()V");
lc->multicast_lock_release_id = env->GetMethodID(lc->multicast_lock_class, "release", "()V");
} else {
lc->multicast_lock=NULL;
lc->multicast_lock_class=NULL;
}
#endif
}
......
......@@ -805,9 +805,11 @@ struct _LinphoneCore
LinphoneCoreVTable *current_vtable; // the latest vtable to call a callback, see linphone_core_get_current_vtable
#ifdef ANDROID
jobject wifi_lock;
jclass wifi_lock_class;
jmethodID wifi_lock_acquire_id;
jmethodID wifi_lock_release_id;
jobject multicast_lock;
jclass multicast_lock_class;
jmethodID multicast_lock_acquire_id;
jmethodID multicast_lock_release_id;
#endif
......
mediastreamer2 @ ca8ad4af
Subproject commit ed0c1f30701c6a3bb0607243834f5b58a2720381
Subproject commit ca8ad4af235b8131d43687343577e98ba0142c72
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment