Fixed test implicit_AVPF test in call_tester.c. Small refactoring.

Added condition in verification on all streams for avpf feature in linphone_call_get_current_params in linphonecall.c .
This commit is contained in:
Sandrine Avakian 2015-12-14 17:11:27 +01:00
parent dbf95f1198
commit 689f1cf86f
2 changed files with 91 additions and 73 deletions

View file

@ -825,7 +825,6 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
setup_encryption_keys(call,md);
setup_dtls_keys(call,md);
if (params->implicit_rtcp_fb) md->streams[call->main_video_stream_index].implicit_rtcp_fb = TRUE;
setup_rtcp_fb(call, md);
setup_rtcp_xr(call, md);
@ -1769,7 +1768,7 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
break;
}
call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md);
call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md);
if (call->current_params->avpf_enabled == TRUE) {
call->current_params->avpf_rr_interval = linphone_call_get_avpf_rr_interval(call);
} else {

View file

@ -2032,100 +2032,113 @@ void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* marie,
}
static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){
LinphoneCall* callee_call;
LinphoneCall* caller_call;
callee_call=linphone_core_get_current_call(callee->lc);
caller_call=linphone_core_get_current_call(caller->lc);
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_send_vfu_request(callee_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
}
else{
BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
}
ms_message ("check_fir : [%p] received %d FIR ",&caller_call ,caller_call->videostream->ms_video_stat.counter_rcvd_fir);
ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&callee_call, callee->stat.number_of_IframeDecoded);
linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
linphone_call_send_vfu_request(caller_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
if (rtp_session_avpf_enabled(caller_call->sessions->rtp_session)) {
if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
}
}
else{
BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
}
ms_message ("check_fir : [%p] received %d FIR ",&callee_call ,callee_call->videostream->ms_video_stat.counter_rcvd_fir);
ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&caller_call, caller->stat.number_of_IframeDecoded);
}
void video_call_base_3(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
LinphoneCall* marie_call;
LinphoneCall* pauline_call;
LinphoneVideoPolicy marie_policy, pauline_policy;
LinphoneCall* callee_call;
LinphoneCall* caller_call;
LinphoneVideoPolicy callee_policy, pauline_policy;
if (using_policy) {
marie_policy.automatically_initiate=FALSE;
marie_policy.automatically_accept=TRUE;
callee_policy.automatically_initiate=FALSE;
callee_policy.automatically_accept=TRUE;
pauline_policy.automatically_initiate=TRUE;
pauline_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(marie->lc,&marie_policy);
linphone_core_set_video_policy(pauline->lc,&pauline_policy);
linphone_core_set_video_policy(callee->lc,&callee_policy);
linphone_core_set_video_policy(caller->lc,&pauline_policy);
}
linphone_core_enable_video_display(marie->lc, callee_video_enabled);
linphone_core_enable_video_capture(marie->lc, callee_video_enabled);
linphone_core_enable_video_display(callee->lc, callee_video_enabled);
linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
linphone_core_enable_video_display(pauline->lc, caller_video_enabled);
linphone_core_enable_video_capture(pauline->lc, caller_video_enabled);
linphone_core_enable_video_display(caller->lc, caller_video_enabled);
linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
marie->lc->user_certificates_path = bc_tester_file("certificates-marie");
pauline->lc->user_certificates_path = bc_tester_file("certificates-pauline");
belle_sip_mkdir(marie->lc->user_certificates_path);
belle_sip_mkdir(pauline->lc->user_certificates_path);
callee->lc->user_certificates_path = bc_tester_file("certificates-marie");
caller->lc->user_certificates_path = bc_tester_file("certificates-pauline");
belle_sip_mkdir(callee->lc->user_certificates_path);
belle_sip_mkdir(caller->lc->user_certificates_path);
}
linphone_core_set_media_encryption(marie->lc,mode);
linphone_core_set_media_encryption(pauline->lc,mode);
linphone_core_set_media_encryption(callee->lc,mode);
linphone_core_set_media_encryption(caller->lc,mode);
/* Create call params */
caller_test_params.base=linphone_core_create_call_params(pauline->lc, NULL);
caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL);
if (!using_policy)
linphone_call_params_enable_video(caller_test_params.base,TRUE);
if (!using_policy){
callee_test_params.base=linphone_core_create_call_params(marie->lc, NULL);
callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
linphone_call_params_enable_video(callee_test_params.base,TRUE);
}
BC_ASSERT_TRUE(call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy));
marie_call=linphone_core_get_current_call(marie->lc);
pauline_call=linphone_core_get_current_call(pauline->lc);
BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy));
callee_call=linphone_core_get_current_call(callee->lc);
caller_call=linphone_core_get_current_call(caller->lc);
linphone_call_params_destroy(caller_test_params.base);
if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
if (marie_call && pauline_call ) {
if (callee_call && caller_call ) {
if (callee_video_enabled && caller_video_enabled) {
BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(marie_call,linphone_call_iframe_decoded_cb,marie->lc);
linphone_call_send_vfu_request(marie_call);
BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
if (rtp_session_avpf_enabled(marie_call->sessions->rtp_session)){
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
}
else{
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
}
ms_message ("video_call_base_3 : [%p] received %d FIR ",&pauline_call ,pauline_call->videostream->ms_video_stat.counter_rcvd_fir);
ms_message ("video_call_base_3 : [%p] stat number of iframe decoded %d ",&marie_call, marie->stat.number_of_IframeDecoded);
linphone_call_set_next_video_frame_decoded_callback(pauline_call,linphone_call_iframe_decoded_cb,pauline->lc);
linphone_call_send_vfu_request(pauline_call);
BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_IframeDecoded,1));
if (rtp_session_avpf_enabled(pauline_call->sessions->rtp_session)){
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
}
else{
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
}
ms_message ("video_call_base_3 : [%p] received %d FIR ",&marie_call ,marie_call->videostream->ms_video_stat.counter_rcvd_fir);
ms_message ("video_call_base_3 : [%p] stat number of iframe decoded %d ",&pauline_call, pauline->stat.number_of_IframeDecoded);
check_fir(caller,callee);
} else {
BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
}
liblinphone_tester_check_rtcp(marie,pauline);
liblinphone_tester_check_rtcp(callee,caller);
}
}
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
video_call_base_2(pauline,marie,using_policy,mode,callee_video_enabled,caller_video_enabled);
end_call(pauline, marie);
@ -2140,16 +2153,22 @@ static void video_call(void) {
}
static void video_call_disable_implicit_AVPF_on_rcv(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LpConfig *pauline_lp;
pauline_lp = linphone_core_get_config(pauline->lc);
lp_config_set_int(pauline_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0);
LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
LpConfig *callee_lp;
const LinphoneCallParams *params, *params2;
video_call_base_3(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
end_call(pauline, marie);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
callee_lp = linphone_core_get_config(callee->lc);
lp_config_set_int(callee_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0);
video_call_base_3(caller,callee,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP");
params2 =linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params2), "RTP/AVP");
end_call(caller, callee);
linphone_core_manager_destroy(callee);
linphone_core_manager_destroy(caller);
}
@ -2160,13 +2179,13 @@ static void video_call_base_avpf(LinphoneCoreManager* pauline,LinphoneCoreManage
end_call(pauline, marie);
}
static void video_call_avpf(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc");
LinphoneCoreManager* marie = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "marie_rc" : "marie_tcp_rc");
video_call_base_avpf(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
linphone_core_manager_destroy(marie);
video_call_base_avpf(pauline,marie,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
static void video_call_zrtp(void) {