From e7637881d0cb1eb182dc929cbc68f8bdd017be6d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 19 Apr 2017 16:46:30 +0200 Subject: [PATCH] Updated linphonecore_jni.cc to reflect latest changes made to LinphoneCallStats --- coreapi/linphonecall.c | 8 ++++++++ coreapi/linphonecore_jni.cc | 35 +++++++++++++++++++++-------------- include/linphone/call_stats.h | 12 ++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 968315939..d4f554a8f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4362,6 +4362,14 @@ float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats) return 100.0f * report_block_get_fraction_lost(rrb) / 256.0f; } +float linphone_call_stats_get_local_loss_rate(const LinphoneCallStats *stats) { + return stats->local_loss_rate; +} + +float linphone_call_stats_get_local_late_rate(const LinphoneCallStats *stats) { + return stats->local_late_rate; +} + float linphone_call_stats_get_sender_interarrival_jitter(const LinphoneCallStats *stats) { const report_block_t *srb = NULL; diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index cd4dc2163..c3083289d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -3423,23 +3423,27 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_wasConference(JNI /* CallStats */ extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getMediaType(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jint)((LinphoneCallStats *)stats_ptr)->type; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jint)linphone_call_stats_get_type(stats); } extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getIceState(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jint)((LinphoneCallStats *)stats_ptr)->ice_state; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jint)linphone_call_stats_get_ice_state(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jfloat)((LinphoneCallStats *)stats_ptr)->download_bandwidth; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jfloat)linphone_call_stats_get_download_bandwidth(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jfloat)((LinphoneCallStats *)stats_ptr)->upload_bandwidth; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jfloat)linphone_call_stats_get_upload_bandwidth(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { - const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; return (jfloat) linphone_call_stats_get_sender_loss_rate(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { - const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; return (jfloat) linphone_call_stats_get_receiver_loss_rate(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr) { @@ -3451,28 +3455,31 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera return (jfloat) linphone_call_stats_get_receiver_interarrival_jitter(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jfloat)((LinphoneCallStats *)stats_ptr)->round_trip_delay; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jfloat)linphone_call_stats_get_round_trip_delay(stats); } extern "C" jlong Java_org_linphone_core_LinphoneCallStatsImpl_getLatePacketsCumulativeNumber(JNIEnv *env, jobject thiz, jlong stats_ptr) { LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; return (jlong) linphone_call_stats_get_late_packets_cumulative_number(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getJitterBufferSize(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jfloat)((LinphoneCallStats *)stats_ptr)->jitter_stats.jitter_buffer_size_ms; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jfloat)linphone_call_stats_get_jitter_buffer_size_ms(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getLocalLossRate(JNIEnv *env, jobject thiz,jlong stats_ptr) { - const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; - return stats->local_loss_rate; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return linphone_call_stats_get_local_loss_rate(stats); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getLocalLateRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { - const LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; - return stats->local_late_rate; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return linphone_call_stats_get_local_late_rate(stats); } extern "C" jint Java_org_linphone_core_LinphoneCallStatsImpl_getIpFamilyOfRemote(JNIEnv *env, jobject thiz, jlong stats_ptr) { - return (jint) ((LinphoneCallStats *)stats_ptr)->rtp_remote_family; + LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; + return (jint) linphone_call_stats_get_ip_family_of_remote(stats); } /*payloadType*/ @@ -3509,7 +3516,7 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCallImpl_getStats(JNIEn ,jlong ptr, jint type) { LinphoneCall *call=(LinphoneCall*)ptr; LinphoneJavaBindings *ljb = (LinphoneJavaBindings *) linphone_core_get_user_data(linphone_call_get_core(call)); - const LinphoneCallStats *stats = linphone_call_get_stats(call, (LinphoneStreamType)type); + LinphoneCallStats *stats = linphone_call_get_stats(call, (LinphoneStreamType)type); return stats ? env->NewObject(ljb->callStatsClass, ljb->callStatsId, (jlong)stats) : NULL; } diff --git a/include/linphone/call_stats.h b/include/linphone/call_stats.h index a5bd96c48..ff2074dba 100644 --- a/include/linphone/call_stats.h +++ b/include/linphone/call_stats.h @@ -88,6 +88,18 @@ LINPHONE_PUBLIC float linphone_call_stats_get_sender_loss_rate(const LinphoneCal **/ LINPHONE_PUBLIC float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats); +/** + * Get the local loss rate since last report + * @return The local loss rate +**/ +LINPHONE_PUBLIC float linphone_call_stats_get_local_loss_rate(const LinphoneCallStats *stats); + +/** + * Gets the local late rate since last report + * @return The local late rate +**/ +LINPHONE_PUBLIC float linphone_call_stats_get_local_late_rate(const LinphoneCallStats *stats); + /** * Gets the local interarrival jitter * @param[in] stats LinphoneCallStats object