mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 00:59:20 +00:00
fix crash in android version, optimize LinphoneCall.getCurrentParams()
This commit is contained in:
parent
7a5bfae02d
commit
c1434a3f7c
4 changed files with 22 additions and 6 deletions
|
|
@ -1282,7 +1282,7 @@ public:
|
|||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
statsobj = env->NewObject(ljb->callStatsClass, ljb->callStatsId, (jlong)call, (jlong)stats);
|
||||
statsobj = env->NewObject(ljb->callStatsClass, ljb->callStatsId, (jlong)stats);
|
||||
callobj = getCall(env, call);
|
||||
env->CallVoidMethod(lcData->listener, ljb->callStatsUpdatedId, lcData->core, callobj, statsobj);
|
||||
handle_possible_java_exception(env, lcData->listener);
|
||||
|
|
@ -3478,6 +3478,14 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCallImpl_getStats(JNIEn
|
|||
return stats ? env->NewObject(ljb->callStatsClass, ljb->callStatsId, (jlong)stats) : NULL;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCallImpl_getCore(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
LinphoneCall *call=(LinphoneCall*)ptr;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *) linphone_core_get_user_data(linphone_call_get_core(call));
|
||||
return ljb->getCore();
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
|
|
@ -5059,7 +5067,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteParams(JNIEnv
|
|||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParams(JNIEnv *env, jobject thiz, jlong lc){
|
||||
return (jlong) linphone_call_params_copy(linphone_call_get_current_params((LinphoneCall*)lc));
|
||||
return (jlong) linphone_call_params_ref((LinphoneCallParams*)linphone_call_get_current_params((LinphoneCall*)lc));
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ public interface LinphoneCall {
|
|||
/**
|
||||
*
|
||||
* Same as getCurrentParams(), but deprecated.
|
||||
* @deprecated
|
||||
**/
|
||||
@deprecated
|
||||
LinphoneCallParams getCurrentParamsCopy();
|
||||
|
||||
void enableCamera(boolean enabled);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ package org.linphone.core;
|
|||
class LinphoneCallImpl implements LinphoneCall {
|
||||
|
||||
protected final long nativePtr;
|
||||
|
||||
boolean ownPtr = false;
|
||||
Object userData;
|
||||
LinphoneCore mCore;
|
||||
|
||||
native private void finalize(long nativePtr);
|
||||
native private long getCallLog(long nativePtr);
|
||||
|
|
@ -45,12 +47,14 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
private native void setListener(long ptr, LinphoneCallListener listener);
|
||||
native private long getDiversionAddress(long nativePtr);
|
||||
native private Object getStats(long nativePtr, int stream_type);
|
||||
native private LinphoneCore getCore(long nativePtr);
|
||||
|
||||
/*
|
||||
* This method must always be called from JNI, nothing else.
|
||||
*/
|
||||
private LinphoneCallImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
mCore = getCore(nativePtr);
|
||||
}
|
||||
protected void finalize() throws Throwable {
|
||||
finalize(nativePtr);
|
||||
|
|
@ -65,10 +69,14 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
}
|
||||
|
||||
public LinphoneCallStats getAudioStats() {
|
||||
return (LinphoneCallStats)getStats(nativePtr, 0);
|
||||
synchronized(mCore){
|
||||
return (LinphoneCallStats)getStats(nativePtr, 0);
|
||||
}
|
||||
}
|
||||
public LinphoneCallStats getVideoStats() {
|
||||
return (LinphoneCallStats)getStats(nativePtr, 1);
|
||||
synchronized(mCore){
|
||||
return (LinphoneCallStats)getStats(nativePtr, 1);
|
||||
}
|
||||
}
|
||||
public CallDirection getDirection() {
|
||||
return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ffdd8375f332e04c0d7642fb1da414124145256e
|
||||
Subproject commit 1f17b3ba22cb662c1c15655c8248036e7a69baf2
|
||||
Loading…
Add table
Reference in a new issue