static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call) { const LinphoneCallStats *as=linphone_call_get_audio_stats(call); const LinphoneCallStats *vs=linphone_call_get_video_stats(call); const char *audio_media_connectivity = _("Direct or through server"); const char *video_media_connectivity = _("Direct or through server"); const LinphoneCallParams *curparams=linphone_call_get_current_params(call); gboolean has_video=linphone_call_params_video_enabled(curparams); MSVideoSize size_received = linphone_call_params_get_received_video_size(curparams); MSVideoSize size_sent = linphone_call_params_get_sent_video_size(curparams); const char *rtp_profile = linphone_call_params_get_rtp_profile(curparams); gchar *tmp = g_strdup_printf("%s", rtp_profile); gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"rtp_profile")),tmp); g_free(tmp); tmp=g_strdup_printf(_("download: %f\nupload: %f (kbit/s)"), as->download_bandwidth,as->upload_bandwidth); gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"audio_bandwidth_usage")),tmp); g_free(tmp); if (has_video) { gchar *size_r=g_strdup_printf(_("%ix%i @ %f fps"),size_received.width,size_received.height, linphone_call_params_get_received_framerate(curparams)); gchar *size_s=g_strdup_printf(_("%ix%i @ %f fps"),size_sent.width,size_sent.height, linphone_call_params_get_sent_framerate(curparams)); 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)"),vs->download_bandwidth,vs->upload_bandwidth); g_free(size_r); g_free(size_s); } else { tmp=NULL; } gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_bandwidth_usage")),tmp); if (tmp) g_free(tmp); if(as->upnp_state != LinphoneUpnpStateNotAvailable && as->upnp_state != LinphoneUpnpStateIdle) { audio_media_connectivity = upnp_state_to_string(as->upnp_state); } else if(as->ice_state != LinphoneIceStateNotActivated) { audio_media_connectivity = ice_state_to_string(as->ice_state); } gtk_label_set_text(GTK_LABEL(linphone_gtk_get_widget(callstats,"audio_media_connectivity")),audio_media_connectivity); if (has_video) { if(vs->upnp_state != LinphoneUpnpStateNotAvailable && vs->upnp_state != LinphoneUpnpStateIdle) { video_media_connectivity = upnp_state_to_string(vs->upnp_state); } else if(vs->ice_state != LinphoneIceStateNotActivated) { video_media_connectivity = ice_state_to_string(vs->ice_state); } } else video_media_connectivity=NULL; gtk_label_set_text(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_media_connectivity")),video_media_connectivity); if (as->round_trip_delay>0) { tmp=g_strdup_printf(_("%.3f seconds"),as->round_trip_delay); gtk_label_set_text(GTK_LABEL(linphone_gtk_get_widget(callstats,"round_trip_time")),tmp); g_free(tmp); } }
void CallStatsModel::updateStats(LinphoneCall *call) { if (!call) { return; } float quality = linphone_call_get_current_quality(call); if (quality >= 4) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_4.png"; } else if (quality >= 3) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_3.png"; } else if (quality >= 2) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_2.png"; } else if (quality >= 1) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_1.png"; } else { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_0.png"; } const LinphoneCallParams *params = linphone_call_get_current_params(call); if (!params) { return; } LinphoneMediaEncryption encryption = linphone_call_params_get_media_encryption(params); _currentCallSecurityIcon = "/images/statusbar/security_ko.png"; if (encryption == LinphoneMediaEncryptionSRTP || encryption == LinphoneMediaEncryptionDTLS) { _currentCallSecurityIcon = "/images/statusbar/security_ok.png"; } else if (encryption == LinphoneMediaEncryptionZRTP) { _callSecurityToken = tr("ZRTP token is %1.\r\nYou should only accept if you have the same token as your correspondent.").arg(linphone_call_get_authentication_token(call)); bool isAuthTokenVerified = linphone_call_get_authentication_token_verified(call); if (isAuthTokenVerified) { _currentCallSecurityIcon = "/images/statusbar/security_ok.png"; } else { _currentCallSecurityIcon = "/images/statusbar/security_pending.png"; } emit zrtpUpdated(); } const LinphoneCallStats *audioStats = linphone_call_get_audio_stats(call); if (audioStats) { _iceStatus = IceStateToString(linphone_call_stats_get_ice_state(audioStats)); _downloadAudioBandwidth = QString("<html>↓ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(audioStats))); _uploadAudioBandwidth = QString("<html>↑ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(audioStats))); } const LinphonePayloadType *audioPayload = linphone_call_params_get_used_audio_codec(params); if (audioPayload) { _audioCodec = QString(linphone_payload_type_get_mime_type(audioPayload)) + "/" + QString::number(payload_type_get_rate(audioPayload)) + "/" + QString::number(linphone_payload_type_get_channels(audioPayload)); } if (linphone_call_params_video_enabled(params)) { const LinphoneCallStats *videoStats = linphone_call_get_video_stats(call); if (videoStats) { _downloadVideoBandwidth = QString("<html>↓ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(videoStats))); _uploadVideoBandwidth = QString("<html>↑ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(videoStats))); } const LinphonePayloadType *videoPayload = linphone_call_params_get_used_video_codec(params); if (videoPayload) { _videoCodec = QString(linphone_payload_type_get_mime_type(videoPayload)); } MSVideoSize sentVideoSize = linphone_call_params_get_sent_video_size(params); float framerate = linphone_call_params_get_sent_framerate(params); _sentVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(sentVideoSize.width), QString::number(sentVideoSize.height), QString::number((int)framerate)); MSVideoSize receivedVideoSize = linphone_call_params_get_received_video_size(params); framerate = linphone_call_params_get_received_framerate(params); _receivedVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(receivedVideoSize.width), QString::number(receivedVideoSize.height), QString::number((int)framerate)); } emit statsUpdated(); }