diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 1b86f235c..352258055 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -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){ diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 76a5c0a38..b2342a410 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -209,8 +209,8 @@ public interface LinphoneCall { /** * * Same as getCurrentParams(), but deprecated. + * @deprecated **/ - @deprecated LinphoneCallParams getCurrentParamsCopy(); void enableCamera(boolean enabled); diff --git a/java/impl/org/linphone/core/LinphoneCallImpl.java b/java/impl/org/linphone/core/LinphoneCallImpl.java index 661fde7ef..c276ce07d 100644 --- a/java/impl/org/linphone/core/LinphoneCallImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallImpl.java @@ -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; diff --git a/mediastreamer2 b/mediastreamer2 index ffdd8375f..1f17b3ba2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ffdd8375f332e04c0d7642fb1da414124145256e +Subproject commit 1f17b3ba22cb662c1c15655c8248036e7a69baf2