Commit 9dbf7e36 authored by Mickaël Turnel's avatar Mickaël Turnel Committed by Sylvain Berfini

Add estimated download bandwith stat for video calls

parent 6fab7844
...@@ -3438,6 +3438,10 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidt ...@@ -3438,6 +3438,10 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidt
LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
return (jfloat)linphone_call_stats_get_upload_bandwidth(stats); return (jfloat)linphone_call_stats_get_upload_bandwidth(stats);
} }
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getEstimatedDownloadBandwidth(JNIEnv *env, jobject thiz, jlong stats_ptr) {
LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
return (jfloat)linphone_call_stats_get_estimated_download_bandwidth(stats);
}
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) { extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderLossRate(JNIEnv *env, jobject thiz, jlong stats_ptr) {
LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr; LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
return (jfloat) linphone_call_stats_get_sender_loss_rate(stats); return (jfloat) linphone_call_stats_get_sender_loss_rate(stats);
......
...@@ -191,6 +191,13 @@ LINPHONE_PUBLIC float linphone_call_stats_get_jitter_buffer_size_ms (const Linph ...@@ -191,6 +191,13 @@ LINPHONE_PUBLIC float linphone_call_stats_get_jitter_buffer_size_ms (const Linph
*/ */
LINPHONE_PUBLIC float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats); LINPHONE_PUBLIC float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats);
/**
* Get the estimated bandwidth measurement of the received stream, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The estimated bandwidth measurement of the received stream in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_estimated_download_bandwidth(const LinphoneCallStats *stats);
/** /**
* @} * @}
*/ */
......
...@@ -139,6 +139,12 @@ public interface LinphoneCallStats { ...@@ -139,6 +139,12 @@ public interface LinphoneCallStats {
* @return The upload bandwidth * @return The upload bandwidth
*/ */
public float getUploadBandwidth(); public float getUploadBandwidth();
/**
* Get the estimated download bandwidth in kbit/s
* @return The estimated download bandwidth
*/
public float getEstimatedDownloadBandwidth();
/** /**
* Get the local loss rate since last report * Get the local loss rate since last report
......
...@@ -24,6 +24,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { ...@@ -24,6 +24,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private int iceState; private int iceState;
private float downloadBandwidth; private float downloadBandwidth;
private float uploadBandwidth; private float uploadBandwidth;
private float estimatedDownloadBandwidth;
private float senderLossRate; private float senderLossRate;
private float receiverLossRate; private float receiverLossRate;
private float senderInterarrivalJitter; private float senderInterarrivalJitter;
...@@ -39,6 +40,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { ...@@ -39,6 +40,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private native int getIceState(long nativeStatsPtr); private native int getIceState(long nativeStatsPtr);
private native float getDownloadBandwidth(long nativeStatsPtr); private native float getDownloadBandwidth(long nativeStatsPtr);
private native float getUploadBandwidth(long nativeStatsPtr); private native float getUploadBandwidth(long nativeStatsPtr);
private native float getEstimatedDownloadBandwidth(long nativeStatsptr);
private native float getSenderLossRate(long nativeStatsPtr); private native float getSenderLossRate(long nativeStatsPtr);
private native float getReceiverLossRate(long nativeStatsPtr); private native float getReceiverLossRate(long nativeStatsPtr);
private native float getSenderInterarrivalJitter(long nativeStatsPtr); private native float getSenderInterarrivalJitter(long nativeStatsPtr);
...@@ -57,6 +59,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { ...@@ -57,6 +59,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
iceState = getIceState(nativeStatsPtr); iceState = getIceState(nativeStatsPtr);
downloadBandwidth = getDownloadBandwidth(nativeStatsPtr); downloadBandwidth = getDownloadBandwidth(nativeStatsPtr);
uploadBandwidth = getUploadBandwidth(nativeStatsPtr); uploadBandwidth = getUploadBandwidth(nativeStatsPtr);
estimatedDownloadBandwidth = getEstimatedDownloadBandwidth(nativeStatsPtr);
senderLossRate = getSenderLossRate(nativeStatsPtr); senderLossRate = getSenderLossRate(nativeStatsPtr);
receiverLossRate = getReceiverLossRate(nativeStatsPtr); receiverLossRate = getReceiverLossRate(nativeStatsPtr);
senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr); senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr);
...@@ -81,6 +84,10 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { ...@@ -81,6 +84,10 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
public float getUploadBandwidth() { public float getUploadBandwidth() {
return uploadBandwidth; return uploadBandwidth;
} }
public float getEstimatedDownloadBandwidth() {
return estimatedDownloadBandwidth;
}
public float getSenderLossRate() { public float getSenderLossRate() {
return senderLossRate; return senderLossRate;
......
...@@ -54,6 +54,7 @@ struct _LinphoneCallStats { ...@@ -54,6 +54,7 @@ struct _LinphoneCallStats {
int rtp_remote_family; /**< Ip adress family of the remote destination */ int rtp_remote_family; /**< Ip adress family of the remote destination */
int clockrate; /*RTP clockrate of the stream, provided here for easily converting timestamp units expressed in RTCP packets in milliseconds*/ int clockrate; /*RTP clockrate of the stream, provided here for easily converting timestamp units expressed in RTCP packets in milliseconds*/
bool_t rtcp_received_via_mux; /*private flag, for non-regression test only*/ bool_t rtcp_received_via_mux; /*private flag, for non-regression test only*/
float estimated_download_bandwidth; /**<Estimated download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
}; };
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallStats); BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallStats);
...@@ -354,3 +355,7 @@ float linphone_call_stats_get_jitter_buffer_size_ms (const LinphoneCallStats *st ...@@ -354,3 +355,7 @@ float linphone_call_stats_get_jitter_buffer_size_ms (const LinphoneCallStats *st
float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats) { float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats) {
return stats->round_trip_delay; return stats->round_trip_delay;
} }
float linphone_call_stats_get_estimated_download_bandwidth(const LinphoneCallStats *stats) {
return stats->estimated_download_bandwidth;
}
...@@ -2297,7 +2297,9 @@ void MediaSessionPrivate::handleStreamEvents (int streamIndex) { ...@@ -2297,7 +2297,9 @@ void MediaSessionPrivate::handleStreamEvents (int streamIndex) {
telephoneEventReceived(evd->info.telephone_event); telephoneEventReceived(evd->info.telephone_event);
} else if (evt == ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE) { } else if (evt == ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE) {
lInfo() << "Video bandwidth estimation is " << (int)(evd->info.video_bandwidth_available / 1000.) << " kbit/s"; lInfo() << "Video bandwidth estimation is " << (int)(evd->info.video_bandwidth_available / 1000.) << " kbit/s";
// TODO /* If this event happens then it should be a video stream */
if (stream_index == call->main_video_stream_index)
stats->estimated_download_bandwidth = (float)(evd->info.video_bandwidth_available)*1e-3;
} }
ortp_event_destroy(ev); ortp_event_destroy(ev);
} }
...@@ -3426,7 +3428,7 @@ void MediaSessionPrivate::reportBandwidth () { ...@@ -3426,7 +3428,7 @@ void MediaSessionPrivate::reportBandwidth () {
lInfo() << "Bandwidth usage for CallSession [" << q << "]:\n" << fixed << setprecision(2) << lInfo() << "Bandwidth usage for CallSession [" << q << "]:\n" << fixed << setprecision(2) <<
"\tRTP audio=[d=" << linphone_call_stats_get_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(audioStats) << "\tRTP audio=[d=" << linphone_call_stats_get_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(audioStats) <<
"], video=[d=" << linphone_call_stats_get_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(videoStats) << "], video=[d=" << linphone_call_stats_get_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(videoStats) << ",ed=" << linphone_call_stats_get_estimated_download_bandwidth(videoStats) <<
"], text=[d=" << linphone_call_stats_get_download_bandwidth(textStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(textStats) << "] kbits/sec\n" << "], text=[d=" << linphone_call_stats_get_download_bandwidth(textStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(textStats) << "] kbits/sec\n" <<
"\tRTCP audio=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(audioStats) << "\tRTCP audio=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(audioStats) <<
"], video=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(videoStats) << "], video=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(videoStats) <<
......
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