]> sjero.net Git - linphone/commitdiff
Extend call statistics JNI.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Tue, 25 Sep 2012 15:21:01 +0000 (17:21 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Tue, 25 Sep 2012 15:21:01 +0000 (17:21 +0200)
Add interface for download bandwidth, upload bandwidth and ICE state.

coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCallStats.java

index e60090c40b6d1ddda159dbadab6207e97e7f609d..cb1c72335d15683bc365d1211dd4dc6531364632 100644 (file)
@@ -1254,6 +1254,15 @@ extern "C" jint Java_org_linphone_core_LinphoneCallLogImpl_getCallDuration(JNIEn
 extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) {
        return (int)((LinphoneCallStats *)stats_ptr)->type;
 }
+extern "C" int Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (int)((LinphoneCallStats *)stats_ptr)->ice_state;
+}
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth;
+}
+extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) {
+       return (jfloat)((LinphoneCallStats *)stats_ptr)->upload_bandwidth;
+}
 extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) {
        const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
        const report_block_t *srb = NULL;
index f391b2a91cf28469329f7224e0842cab33edcd2f..15b4cfb3462d593152f9de6e2ee28eda8ed835f5 100644 (file)
@@ -51,6 +51,51 @@ public interface LinphoneCallStats {
                        return mStringValue;
                }
        }
+       static public class IceState {
+               static private Vector values = new Vector();
+               /**
+                * Not activated
+                */
+               static public IceState NotActivated = new IceState(0, "Not activated");
+               /**
+                * Failed
+                */
+               static public IceState Failed = new IceState(1, "Failed");
+               /**
+                * In progress
+                */
+               static public IceState InProgress = new IceState(2, "In progress");
+               /**
+                * Host connection
+                */
+               static public IceState HostConnection = new IceState(3, "Host connection");
+               /**
+                * Reflexive connection
+                */
+               static public IceState ReflexiveConnection = new IceState(4, "Reflexive connection");
+               /**
+                * Relay connection
+                */
+               static public IceState RelayConnection = new IceState(5, "Relay connection");
+               protected final int mValue;
+               private final String mStringValue;
+
+               private IceState(int value, String stringValue) {
+                       mValue = value;
+                       values.addElement(this);
+                       mStringValue = stringValue;
+               }
+               public static IceState fromInt(int value) {
+                       for (int i = 0; i < values.size(); i++) {
+                               IceState mstate = (IceState) values.elementAt(i);
+                               if (mstate.mValue == value) return mstate;
+                       }
+                       throw new RuntimeException("IceState not found [" + value + "]");
+               }
+               public String toString() {
+                       return mStringValue;
+               }
+       }
 
        /**
         * Get the stats media type
@@ -58,6 +103,23 @@ public interface LinphoneCallStats {
         */
        public MediaType getMediaType();
 
+       /**
+        * Get the ICE state
+        */
+       public IceState getIceState();
+
+       /**
+        * Get the download bandwidth in kbit/s
+        * @return The download bandwidth
+        */
+       public float getDownloadBandwidth();
+
+       /**
+        * Get the upload bandwidth in kbit/s
+        * @return The upload bandwidth
+        */
+       public float getUploadBandwidth();
+
        /**
         * Get the sender loss rate since last report
         * @return The sender loss rate