mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 11:38:08 +00:00
add jni and java accessors for realtime late and loss rates
This commit is contained in:
parent
7b6c926192
commit
374f170fb2
5 changed files with 58 additions and 6 deletions
|
|
@ -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) {
|
||||
if (mediatype==LINPHONE_CALL_STATS_AUDIO)
|
||||
linphone_call_get_audio_stats((LinphoneCall*)call_ptr);
|
||||
else
|
||||
linphone_call_get_video_stats((LinphoneCall*)call_ptr);
|
||||
}
|
||||
|
||||
/*payloadType*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//LinphoneFriend
|
||||
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) {
|
||||
nativePtr=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);
|
||||
localLossRate=getLocalLossRate(nativePtr);
|
||||
localLateRate=getLocalLateRate(nativePtr);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit abf2a7ec461ac411703233e3554e985d62fa0b9c
|
||||
Subproject commit 4f93003c1eade1442fdedd8dee10f18c98ec47c3
|
||||
Loading…
Add table
Reference in a new issue