static void call_multicast_base(bool_t video) { LinphoneCoreManager *marie, *pauline; int begin; int leaked_objects; LinphoneVideoPolicy marie_policy, pauline_policy; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); if (video) { linphone_core_enable_video_capture(marie->lc, TRUE); linphone_core_enable_video_display(marie->lc, TRUE); linphone_core_enable_video_capture(pauline->lc, TRUE); linphone_core_enable_video_display(pauline->lc, FALSE); marie_policy.automatically_initiate=TRUE; marie_policy.automatically_accept=TRUE; pauline_policy.automatically_initiate=TRUE; pauline_policy.automatically_accept=TRUE; linphone_core_set_video_policy(marie->lc,&marie_policy); linphone_core_set_video_policy(pauline->lc,&pauline_policy); linphone_core_set_video_multicast_addr(pauline->lc,"224.1.2.3"); linphone_core_enable_video_multicast(pauline->lc,TRUE); } linphone_core_set_audio_multicast_addr(pauline->lc,"224.1.2.3"); linphone_core_enable_audio_multicast(pauline->lc,TRUE); CU_ASSERT_TRUE(call(pauline,marie)); wait_for_until(marie->lc, pauline->lc, NULL, 1, 3000); if (linphone_core_get_current_call(marie->lc)) { CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70); if (video) { /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_cb,marie->lc); linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc)); CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); } end_call(marie,pauline); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; CU_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } belle_sip_object_enable_leak_detector(FALSE); }
static void call_failed_because_of_codecs(void) { int begin,leaked_objects; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); LinphoneCall* out_call; disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1); disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1); out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); /*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/ CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000)); CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } leaked_objects=belle_sip_object_get_object_count()-begin; CU_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } }
static void text_message_with_ack(void) { int leaked_objects; int begin; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); char* to = linphone_address_as_string(marie->identity); LinphoneChatRoom* chat_room = linphone_core_create_chat_room(pauline->lc,to); LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu"); LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message); int dummy=0; wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/ reset_counters(&marie->stat); reset_counters(&pauline->stat); linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_room_send_chat_message(chat_room,message); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } leaked_objects=belle_sip_object_get_object_count()-begin; CU_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } }
static void simple_call_with_different_codec_mappings(void) { int begin; int leaked_objects; LinphoneCoreManager* marie; LinphoneCoreManager* pauline; LinphoneCall *pauline_call; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1); disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1); /*marie set a fantasy number to PCMU*/ linphone_core_set_payload_type_number(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, -1), 104); CU_ASSERT_TRUE(call(marie,pauline)); pauline_call=linphone_core_get_current_call(pauline->lc); CU_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call){ LinphoneCallParams *params; check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104); /*make a reinvite in the other direction*/ linphone_core_update_call(pauline->lc, pauline_call, params=linphone_core_create_call_params(pauline->lc, pauline_call)); linphone_call_params_unref(params); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); /*payload type numbers shall remain the same*/ check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104); } end_call(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; CU_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } }
static void call_multicast_base(bool_t video) { LinphoneCoreManager *marie, *pauline; int begin; int leaked_objects; LinphoneVideoPolicy marie_policy, pauline_policy; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_tcp_rc"); if (video) { linphone_core_enable_video_capture(marie->lc, TRUE); linphone_core_enable_video_display(marie->lc, TRUE); linphone_core_enable_video_capture(pauline->lc, TRUE); linphone_core_enable_video_display(pauline->lc, FALSE); marie_policy.automatically_initiate=TRUE; marie_policy.automatically_accept=TRUE; pauline_policy.automatically_initiate=TRUE; pauline_policy.automatically_accept=TRUE; linphone_core_set_video_policy(marie->lc,&marie_policy); linphone_core_set_video_policy(pauline->lc,&pauline_policy); linphone_core_set_video_multicast_addr(pauline->lc,"224.1.2.3"); linphone_core_enable_video_multicast(pauline->lc,TRUE); } linphone_core_set_audio_multicast_addr(pauline->lc,"224.1.2.3"); linphone_core_enable_audio_multicast(pauline->lc,TRUE); BC_ASSERT_TRUE(call(pauline,marie)); wait_for_until(marie->lc, pauline->lc, NULL, 1, 6000); if (linphone_core_get_current_call(marie->lc)) { BC_ASSERT_GREATER(linphone_core_manager_get_max_audio_down_bw(marie),70,int,"%d"); if (video) { /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_iframe_decoded_cb,marie->lc); linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc)); BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); } end_call(marie,pauline); }
void liblinphone_tester_before_each(void) { if (!liblinphone_tester_leak_detector_disabled){ belle_sip_object_enable_leak_detector(TRUE); leaked_objects_count = belle_sip_object_get_object_count(); } }
static void early_media_with_multicast_base(bool_t video) { LinphoneCoreManager *marie, *pauline, *pauline2; MSList* lcs = NULL; int dummy=0; int leaked_objects; int begin; LinphoneVideoPolicy marie_policy, pauline_policy; LpConfig *marie_lp; belle_sip_object_enable_leak_detector(TRUE); begin=belle_sip_object_get_object_count(); marie = linphone_core_manager_new("marie_rc"); pauline = linphone_core_manager_new("pauline_rc"); pauline2 = linphone_core_manager_new("pauline_rc"); marie_lp=linphone_core_get_config(marie->lc); lp_config_set_int(marie_lp,"misc","real_early_media",1); if (video) { linphone_core_enable_video_capture(pauline->lc, FALSE); linphone_core_enable_video_display(pauline->lc, TRUE); linphone_core_enable_video_capture(pauline2->lc, FALSE); linphone_core_enable_video_display(pauline2->lc, TRUE); linphone_core_enable_video_capture(marie->lc, TRUE); linphone_core_enable_video_display(marie->lc, FALSE); marie_policy.automatically_initiate=TRUE; marie_policy.automatically_accept=TRUE; pauline_policy.automatically_initiate=TRUE; pauline_policy.automatically_accept=TRUE; linphone_core_set_video_policy(marie->lc,&marie_policy); linphone_core_set_video_policy(pauline->lc,&pauline_policy); linphone_core_set_video_policy(pauline2->lc,&pauline_policy); linphone_core_set_video_multicast_addr(marie->lc,"224.1.2.3"); linphone_core_enable_video_multicast(marie->lc,TRUE); } linphone_core_set_audio_multicast_addr(marie->lc,"224.1.2.3"); linphone_core_enable_audio_multicast(marie->lc,TRUE); lcs = ms_list_append(lcs,marie->lc); lcs = ms_list_append(lcs,pauline->lc); lcs = ms_list_append(lcs,pauline2->lc); /* Marie calls Pauline, and after the call has rung, transitions to an early_media session */ linphone_core_invite_address(marie->lc, pauline->identity); CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); if (linphone_core_inc_invite_pending(pauline->lc)) { /* send a 183 to initiate the early media */ if (video) { /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(pauline->lc),linphone_call_cb,pauline->lc); } linphone_core_accept_early_media(pauline->lc, linphone_core_get_current_call(pauline->lc)); CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); if (linphone_core_inc_invite_pending(pauline2->lc)) { /* send a 183 to initiate the early media */ if (video) { /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(pauline2->lc),linphone_call_cb,pauline2->lc); } linphone_core_accept_early_media(pauline2->lc, linphone_core_get_current_call(pauline2->lc)); CU_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); } wait_for_list(lcs, &dummy, 1, 3000); CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90); CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70); CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90); if (video) { CU_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000)); CU_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000)); } linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc)); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); linphone_core_update_call( pauline->lc , linphone_core_get_current_call(pauline->lc) , linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))); CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 2,1000)); end_call(marie,pauline); } ms_free(lcs); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(pauline2); leaked_objects=belle_sip_object_get_object_count()-begin; CU_ASSERT_EQUAL(leaked_objects,0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } belle_sip_object_enable_leak_detector(FALSE); }
void belle_sip_tester_before_each() { belle_sip_object_enable_leak_detector(TRUE); leaked_objects_count = belle_sip_object_get_object_count(); }