Commit 9f05b7aa authored by Simon Morlat's avatar Simon Morlat
Browse files

fix implicit avpf test race condition

parent 1e5fb420
......@@ -2068,7 +2068,7 @@ void linphone_call_send_vfu_request(LinphoneCall *call) {
ms_message("Request Full Intra Request on call [%p]", call);
video_stream_send_fir(call->videostream);
} else if (call->core->sip_conf.vfu_with_info) {
ms_message("Request SIP INFO FIR on call [%p]", call);
ms_message("Request SIP INFO FIR on call [%p]", call);
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
sal_call_send_vfu_request(call->op);
} else {
......
......@@ -2192,111 +2192,109 @@ void video_call_base_2(LinphoneCoreManager* caller,LinphoneCoreManager* callee,
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));
LinphoneCall* callee_call;
LinphoneCall* caller_call;
callee_call=linphone_core_get_current_call(callee->lc);
caller_call=linphone_core_get_current_call(caller->lc);
if (rtp_session_avpf_enabled(caller_call->sessions->rtp_session)) {
/*check video path is established in both directions.
Indeed, FIR are ignored until the first RTP packet is received, because SSRC is not known.*/
linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
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);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
linphone_call_send_vfu_request(callee_call);
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* 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};
LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
LinphoneCall* callee_call;
LinphoneCall* caller_call;
LinphoneVideoPolicy callee_policy, caller_policy;
LinphoneCall* callee_call;
LinphoneCall* caller_call;
LinphoneVideoPolicy callee_policy, caller_policy;
if (using_policy) {
callee_policy.automatically_initiate=FALSE;
callee_policy.automatically_accept=TRUE;
caller_policy.automatically_initiate=TRUE;
caller_policy.automatically_accept=FALSE;
if (using_policy) {
callee_policy.automatically_initiate=FALSE;
callee_policy.automatically_accept=TRUE;
caller_policy.automatically_initiate=TRUE;
caller_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(callee->lc,&callee_policy);
linphone_core_set_video_policy(caller->lc,&caller_policy);
}
linphone_core_set_video_policy(callee->lc,&callee_policy);
linphone_core_set_video_policy(caller->lc,&caller_policy);
}
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(callee->lc, callee_video_enabled);
linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
linphone_core_enable_video_display(caller->lc, caller_video_enabled);
linphone_core_enable_video_capture(caller->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 */
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
char *path = bc_tester_file("certificates-marie");
callee->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
path = bc_tester_file("certificates-pauline");
caller->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
belle_sip_mkdir(callee->lc->user_certificates_path);
belle_sip_mkdir(caller->lc->user_certificates_path);
}
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(caller->lc, NULL);
if (!using_policy)
linphone_call_params_enable_video(caller_test_params.base,TRUE);
belle_sip_mkdir(callee->lc->user_certificates_path);
belle_sip_mkdir(caller->lc->user_certificates_path);
}
if (!using_policy){
callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
linphone_call_params_enable_video(callee_test_params.base,TRUE);
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(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(callee->lc, NULL);
linphone_call_params_enable_video(callee_test_params.base,TRUE);
}
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);
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);
linphone_call_params_destroy(caller_test_params.base);
if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
if (callee_call && caller_call ) {
if (callee_video_enabled && caller_video_enabled) {
check_fir(caller,callee);
} else {
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(callee,caller);
}
if (callee_call && caller_call ) {
if (callee_video_enabled && caller_video_enabled) {
check_fir(caller,callee);
} else {
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(callee,caller);
}
}
......
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