Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
776d5867
Commit
776d5867
authored
Sep 22, 2011
by
Simon Morlat
Browse files
implement uniques LinphoneCall in java
parent
a9d3c766
Changes
1
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore_jni.cc
View file @
776d5867
...
...
@@ -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"
j
long
Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall
(
JNIEnv
*
env
extern
"C"
j
object
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
,
jobject
thiz
,
jlong
ptr
)
{
linphone_call_ref
((
LinphoneCall
*
)
ptr
);
}
extern
"C"
void
Java_org_linphone_core_LinphoneCallImpl_unref
(
JNIEnv
*
env
extern
"C"
void
Java_org_linphone_core_LinphoneCallImpl_finalize
(
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment