Commit 374f170f authored by Simon Morlat's avatar Simon Morlat
Browse files

add jni and java accessors for realtime late and loss rates

parent 7b6c9261
......@@ -1578,6 +1578,23 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getJitterBufferSi
return (jfloat)((LinphoneCallStats *)stats_ptr)->jitter_stats.jitter_buffer_size_ms;
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;
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;
extern "C" void Java_org_linphone_core_LinphoneCallStatsImpl_updateStats(JNIEnv *env, jobject thiz, jlong call_ptr, jint mediatype) {
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
PayloadType* pt = (PayloadType*)ptr;
......@@ -1702,7 +1719,6 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallImpl_getAverageQuality( JNI
return (jfloat)linphone_call_get_average_quality((LinphoneCall*)ptr);
extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
,jobject thiz
......@@ -121,25 +121,25 @@ public interface LinphoneCallStats {
public float getUploadBandwidth();
* Get the sender loss rate since last report
* Get the local loss rate since last report
* @return The sender loss rate
public float getSenderLossRate();
* Get the receiver loss rate since last report
* Get the remote reported loss rate since last report
* @return The receiver loss rate
public float getReceiverLossRate();
* Get the sender interarrival jitter
* Get the local interarrival jitter
* @return The interarrival jitter at last emitted sender report
public float getSenderInterarrivalJitter();
* Get the receiver interarrival jitter
* Get the remote reported interarrival jitter
* @return The interarrival jitter at last received receiver report
public float getReceiverInterarrivalJitter();
......@@ -161,4 +161,16 @@ public interface LinphoneCallStats {
* @return The jitter buffer size in milliseconds
public float getJitterBufferSize();
* Get the local loss rate. Unlike getSenderLossRate() that returns this loss rate "since last emitted RTCP report", the value returned here is updated every second.
* @return The local loss rate percentage.
public float getLocalLossRate();
* Get the local late packets rate. The value returned here is updated every second.
* @return The local late rate percentage.
public float getLocalLateRate();
......@@ -68,9 +68,11 @@ class LinphoneCallImpl implements LinphoneCall {
videoStats = stats;
public LinphoneCallStats getAudioStats() {
if (audioStats!=null) ((LinphoneCallStatsImpl)audioStats).updateRealTimeStats(this);
return audioStats;
public LinphoneCallStats getVideoStats() {
if (videoStats!=null) ((LinphoneCallStatsImpl)videoStats).updateRealTimeStats(this);
return videoStats;
public CallDirection getDirection() {
......@@ -31,6 +31,9 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private float roundTripDelay;
private long latePacketsCumulativeNumber;
private float jitterBufferSize;
private float localLossRate;
private float localLateRate;
private long nativePtr;
private native int getMediaType(long nativeStatsPtr);
private native int getIceState(long nativeStatsPtr);
......@@ -43,8 +46,12 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private native float getRoundTripDelay(long nativeStatsPtr);
private native long getLatePacketsCumulativeNumber(long nativeStatsPtr, long nativeCallPtr);
private native float getJitterBufferSize(long nativeStatsPtr);
private native float getLocalLossRate(long nativeStatsPtr);
private native float getLocalLateRate(long nativeStatsPtr);
private native void updateStats(long nativeCallPtr, int mediaType);
protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) {
mediaType = getMediaType(nativeStatsPtr);
iceState = getIceState(nativeStatsPtr);
downloadBandwidth = getDownloadBandwidth(nativeStatsPtr);
......@@ -56,6 +63,13 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
roundTripDelay = getRoundTripDelay(nativeStatsPtr);
latePacketsCumulativeNumber = getLatePacketsCumulativeNumber(nativeStatsPtr, nativeCallPtr);
jitterBufferSize = getJitterBufferSize(nativeStatsPtr);
protected void updateRealTimeStats(LinphoneCall call){
updateStats( ((LinphoneCallImpl)call).nativePtr, mediaType);
public MediaType getMediaType() {
......@@ -101,4 +115,12 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
public float getJitterBufferSize() {
return jitterBufferSize;
public float getLocalLossRate(){
return localLossRate;
public float getLocalLateRate(){
return localLateRate;
mediastreamer2 @ 4f93003c
Subproject commit abf2a7ec461ac411703233e3554e985d62fa0b9c
Subproject commit 4f93003c1eade1442fdedd8dee10f18c98ec47c3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment