From c7f6a5a4f828074eee318c5f7e9c28116569c750 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 12 Aug 2014 16:13:36 +0200 Subject: [PATCH] Add JNI for detect VBR codec --- coreapi/linphonecore_jni.cc | 7 +++++++ java/common/org/linphone/core/LinphoneCore.java | 9 ++++++++- java/impl/org/linphone/core/LinphoneCoreImpl.java | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 115f4a6fb..1b00f795d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1272,6 +1272,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isPayloadTypeEnabled return (jboolean) linphone_core_payload_type_enabled((LinphoneCore*)lc, (PayloadType*)pt); } +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_payloadTypeIsVbr(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jlong pt) { + return (jboolean) linphone_core_payload_type_is_vbr((LinphoneCore*)lc, (PayloadType*)pt); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPayloadTypeBitrate(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index a74ebc125..5328442fd 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -689,10 +689,17 @@ public interface LinphoneCore { void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException; /** - * Returns whether or not the payload is enabled in linphonecore. + * @param pt the payload type + * @return whether or not the payload is enabled in linphonecore. */ boolean isPayloadTypeEnabled(PayloadType pt); + /** + * @param pt the payload type + * @return whether or not the payload epresents a VBR codec + */ + boolean payloadTypeIsVbr(PayloadType pt); + /** * Set an explicit bitrate (IP bitrate, not codec bitrate) for a given codec, in kbit/s. * @param pt the payload type diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 04a679f1a..dc2a9188b 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -73,6 +73,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native long findPayloadType(long nativePtr, String mime, int clockRate, int channels); private native int enablePayloadType(long nativePtr, long payloadType, boolean enable); private native boolean isPayloadTypeEnabled(long nativePtr, long payloadType); + private native boolean payloadTypeIsVbr(long nativePtr, long payloadType); private native void enableAdaptiveRateControl(long nativePtr,boolean enable); private native boolean isAdaptiveRateControlEnabled(long nativePtr); private native void enableEchoCancellation(long nativePtr,boolean enable); @@ -341,6 +342,12 @@ class LinphoneCoreImpl implements LinphoneCore { isValid(); return isPayloadTypeEnabled(nativePtr, ((PayloadTypeImpl)pt).nativePtr); } + + public synchronized boolean payloadTypeIsVbr(PayloadType pt) { + isValid(); + return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl)pt).nativePtr); + } + public synchronized void enableEchoCancellation(boolean enable) { isValid(); enableEchoCancellation(nativePtr, enable);