mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
implement uniques LinphoneCall in java
This commit is contained in:
parent
a9d3c766fd
commit
776d58673a
1 changed files with 34 additions and 12 deletions
|
|
@ -264,6 +264,24 @@ public:
|
|||
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
|
||||
message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
jobject getCall(JNIEnv *env , LinphoneCall *call){
|
||||
jobject jobj=0;
|
||||
|
||||
if (call!=NULL){
|
||||
void *up=linphone_call_get_user_pointer(call);
|
||||
|
||||
if (up==NULL){
|
||||
jobj=env->NewObject(callClass,callCtrId,(jlong)call);
|
||||
linphone_call_set_user_pointer(call,(void*)jobj);
|
||||
//env->NewGlobalRef(jobj);
|
||||
linphone_call_ref(call);
|
||||
}else{
|
||||
jobj=(jobject)up;
|
||||
}
|
||||
}
|
||||
return jobj;
|
||||
}
|
||||
|
||||
static void callStateChange(LinphoneCore *lc, LinphoneCall* call,LinphoneCallState state,const char* message) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
|
|
@ -275,7 +293,7 @@ public:
|
|||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->callStateId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call)
|
||||
,lcData->getCall(env,call)
|
||||
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
|
||||
message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
|
|
@ -290,7 +308,7 @@ public:
|
|||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->callEncryptionChangedId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call)
|
||||
,lcData->getCall(env,call)
|
||||
,encrypted
|
||||
,authentication_token ? env->NewStringUTF(authentication_token) : NULL);
|
||||
}
|
||||
|
|
@ -640,11 +658,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isEchoCancellationEn
|
|||
return linphone_core_echo_cancellation_enabled((LinphoneCore*)lc);
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env
|
||||
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
) {
|
||||
return (jlong)linphone_core_get_current_call((LinphoneCore*)lc);
|
||||
LinphoneCoreData *lcdata=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)lc);
|
||||
|
||||
return lcdata->getCall(env,linphone_core_get_current_call((LinphoneCore*)lc));
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
|
||||
,jobject thiz
|
||||
|
|
@ -1003,16 +1023,18 @@ extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobj
|
|||
}
|
||||
|
||||
//LinphoneCall
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_finalize(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
linphone_call_ref((LinphoneCall*)ptr);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
linphone_call_unref((LinphoneCall*)ptr);
|
||||
LinphoneCall *call=(LinphoneCall*)ptr;
|
||||
jobject jobj=(jobject)linphone_call_get_user_pointer(call);
|
||||
if (jobj==thiz){
|
||||
//env->DeleteGlobalRef(jobj);
|
||||
}else{
|
||||
ms_error("Call being destroyed is inconsistent: thiz=%lu, jobj=%lu",(unsigned long)thiz,(unsigned long)jobj);
|
||||
}
|
||||
linphone_call_set_user_pointer(call,NULL);
|
||||
linphone_call_unref(call);
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* env
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue