static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t avpf2, LinphoneMediaEncryption srtp2, bool_t encryption_mandatory, const char *expected_profile) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); LinphoneProxyConfig *lpc; const LinphoneCallParams *params; if (avpf1) { linphone_core_get_default_proxy(marie->lc, &lpc); linphone_proxy_config_enable_avpf(lpc, TRUE); linphone_proxy_config_set_avpf_rr_interval(lpc, 3); } if (avpf2) { linphone_core_get_default_proxy(pauline->lc, &lpc); linphone_proxy_config_enable_avpf(lpc, TRUE); linphone_proxy_config_set_avpf_rr_interval(lpc, 3); } if (encryption_mandatory) { linphone_core_set_media_encryption_mandatory(marie->lc,TRUE); linphone_core_set_media_encryption_mandatory(pauline->lc,TRUE); } if (linphone_core_media_encryption_supported(marie->lc, srtp1)) { linphone_core_set_media_encryption(marie->lc, srtp1); } else { ms_message("Unsupported [%s] encryption type, cannot test",linphone_media_encryption_to_string(srtp1)); goto end; } if (linphone_core_media_encryption_supported(pauline->lc, srtp2)) { linphone_core_set_media_encryption(pauline->lc, srtp2); }else { ms_message("Unsupported [%s] encryption type, cannot test",linphone_media_encryption_to_string(srtp2)); goto end; } CU_ASSERT_TRUE(call(marie, pauline)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); if (linphone_core_get_current_call(marie->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } if (linphone_core_get_current_call(pauline->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } linphone_core_terminate_all_calls(marie->lc); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1); CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1); end: linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); }
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); } }