Commit a554ad1c authored by Mickaël Turnel's avatar Mickaël Turnel

Add estimated download bandwith stat for video calls

parent ae5d7165
......@@ -4514,6 +4514,10 @@ float linphone_call_stats_get_upload_bandwidth(const LinphoneCallStats *stats) {
return stats->upload_bandwidth;
}
float linphone_call_stats_get_estimated_download_bandwidth(const LinphoneCallStats *stats) {
return stats->estimated_download_bandwidth;
}
LinphoneIceState linphone_call_stats_get_ice_state(const LinphoneCallStats *stats) {
return stats->ice_state;
}
......@@ -4586,13 +4590,14 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
report_bandwidth_for_stream(call, ts, LinphoneStreamTypeText);
ms_message( "Bandwidth usage for call [%p]:\n"
"\tRTP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f], text=[d=%5.1f,u=%5.1f] kbits/sec\n"
"\tRTP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f, ed=%5.1f], text=[d=%5.1f,u=%5.1f] kbits/sec\n"
"\tRTCP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f], text=[d=%5.1f,u=%5.1f] kbits/sec",
call,
call->audio_stats->download_bandwidth,
call->audio_stats->upload_bandwidth,
call->video_stats->download_bandwidth,
call->video_stats->upload_bandwidth,
call->video_stats->estimated_download_bandwidth,
call->text_stats->download_bandwidth,
call->text_stats->upload_bandwidth,
call->audio_stats->rtcp_download_bandwidth,
......@@ -4852,7 +4857,9 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){
linphone_core_dtmf_received(call,evd->info.telephone_event);
} else if (evt == ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE) {
ms_message("Video bandwidth estimation is %i kbit/s", (int)evd->info.video_bandwidth_available / 1000);
//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);
}
......
......@@ -3447,6 +3447,10 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getUploadBandwidt
LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
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) {
LinphoneCallStats *stats = (LinphoneCallStats *)stats_ptr;
return (jfloat) linphone_call_stats_get_sender_loss_rate(stats);
......
......@@ -1819,6 +1819,7 @@ struct _LinphoneCallStats {
LinphoneUpnpState upnp_state; /**< State of uPnP processing. */
float download_bandwidth; /**<Download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float upload_bandwidth; /**<Download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float estimated_download_bandwidth; /**<Estimated download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float local_late_rate; /**<percentage of packet received too late over last second*/
float local_loss_rate; /**<percentage of lost packet over last second*/
int updated; /**< Tell which RTCP packet has been updated (received_rtcp or sent_rtcp). Can be either LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE or LINPHONE_CALL_STATS_SENT_RTCP_UPDATE */
......
......@@ -268,7 +268,10 @@ static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_recv")),size_r);
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_sent")),size_s);
tmp=g_strdup_printf(_("download: %f\nupload: %f (kbit/s)"),linphone_call_stats_get_download_bandwidth(vs),linphone_call_stats_get_upload_bandwidth(vs));
tmp=g_strdup_printf(_("download: %f (kbit/s)\nupload: %f (kbit/s)\nestimated download: %f (kbits/s)"),
linphone_call_stats_get_download_bandwidth(vs),
linphone_call_stats_get_upload_bandwidth(vs),
linphone_call_stats_get_estimated_download_bandwidth(vs));
g_free(size_r);
g_free(size_s);
} else {
......
......@@ -137,6 +137,13 @@ LINPHONE_PUBLIC float linphone_call_stats_get_download_bandwidth(const LinphoneC
*/
LINPHONE_PUBLIC float linphone_call_stats_get_upload_bandwidth(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);
/**
* Get the state of ICE processing.
* @param[in] stats LinphoneCallStats object
......
......@@ -139,6 +139,12 @@ public interface LinphoneCallStats {
* @return The upload bandwidth
*/
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
......
......@@ -24,6 +24,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private int iceState;
private float downloadBandwidth;
private float uploadBandwidth;
private float estimatedDownloadBandwidth;
private float senderLossRate;
private float receiverLossRate;
private float senderInterarrivalJitter;
......@@ -39,6 +40,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
private native int getIceState(long nativeStatsPtr);
private native float getDownloadBandwidth(long nativeStatsPtr);
private native float getUploadBandwidth(long nativeStatsPtr);
private native float getEstimatedDownloadBandwidth(long nativeStatsptr);
private native float getSenderLossRate(long nativeStatsPtr);
private native float getReceiverLossRate(long nativeStatsPtr);
private native float getSenderInterarrivalJitter(long nativeStatsPtr);
......@@ -57,6 +59,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
iceState = getIceState(nativeStatsPtr);
downloadBandwidth = getDownloadBandwidth(nativeStatsPtr);
uploadBandwidth = getUploadBandwidth(nativeStatsPtr);
estimatedDownloadBandwidth = getEstimatedDownloadBandwidth(nativeStatsPtr);
senderLossRate = getSenderLossRate(nativeStatsPtr);
receiverLossRate = getReceiverLossRate(nativeStatsPtr);
senderInterarrivalJitter = getSenderInterarrivalJitter(nativeStatsPtr);
......@@ -81,6 +84,10 @@ class LinphoneCallStatsImpl implements LinphoneCallStats {
public float getUploadBandwidth() {
return uploadBandwidth;
}
public float getEstimatedDownloadBandwidth() {
return estimatedDownloadBandwidth;
}
public float getSenderLossRate() {
return senderLossRate;
......
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