...
 
Commits (6)
......@@ -69,12 +69,10 @@ cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENAB
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
......
......@@ -94,7 +94,7 @@ static void _linphone_factory_destroying_cb(void) {
#define ADD_SUPPORTED_VIDEO_DEFINITION(factory, width, height, name) \
(factory)->supported_video_definitions = bctbx_list_append((factory)->supported_video_definitions, \
linphone_video_definition_ref(linphone_video_definition_new(width, height, name)))
linphone_video_definition_new(width, height, name))
static void initialize_supported_video_definitions(LinphoneFactory *factory) {
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
......@@ -179,7 +179,8 @@ LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
}
LinphoneVideoDefinition * linphone_factory_create_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height) {
return linphone_video_definition_ref(linphone_video_definition_new(width, height, NULL));
LinphoneVideoDefinition *supported = linphone_factory_find_supported_video_definition(factory, width, height);
return supported ? linphone_video_definition_clone(supported) : linphone_video_definition_new(width, height, NULL);
}
LinphoneVideoDefinition * linphone_factory_create_video_definition_from_name(const LinphoneFactory *factory, const char *name) {
......@@ -201,16 +202,17 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const
const bctbx_list_t *item;
const bctbx_list_t *supported = linphone_factory_get_supported_video_definitions(factory);
LinphoneVideoDefinition *searched_vdef = linphone_video_definition_new(width, height, NULL);
LinphoneVideoDefinition *found = NULL;
for (item = supported; item != NULL; item = bctbx_list_next(item)) {
LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item);
if (linphone_video_definition_equals(svdef, searched_vdef)) {
linphone_video_definition_unref(searched_vdef);
return linphone_video_definition_clone(svdef);
found = svdef;
break;
}
}
return searched_vdef;
linphone_video_definition_unref(searched_vdef);
return found;
}
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name) {
......@@ -220,7 +222,7 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_na
for (item = supported; item != NULL; item = bctbx_list_next(item)) {
LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item);
if (strcmp(linphone_video_definition_get_name(svdef), name) == 0) {
return linphone_video_definition_clone(svdef);
return svdef;
}
}
return NULL;
......
......@@ -2040,10 +2040,10 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
if (vstream != NULL) {
call->current_params->sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params->recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params->sent_vdef = linphone_video_definition_ref(linphone_factory_find_supported_video_definition(
linphone_factory_get(), call->current_params->sent_vsize.width, call->current_params->sent_vsize.height));
call->current_params->recv_vdef = linphone_video_definition_ref(linphone_factory_find_supported_video_definition(
linphone_factory_get(), call->current_params->recv_vsize.width, call->current_params->recv_vsize.height));
call->current_params->sent_vdef = linphone_factory_create_video_definition(
linphone_factory_get(), call->current_params->sent_vsize.width, call->current_params->sent_vsize.height);
call->current_params->recv_vdef = linphone_factory_create_video_definition(
linphone_factory_get(), call->current_params->recv_vsize.width, call->current_params->recv_vsize.height);
call->current_params->sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params->received_fps = video_stream_get_received_framerate(vstream);
}
......
......@@ -27,13 +27,23 @@ static void linphone_video_definition_destroy(LinphoneVideoDefinition *vdef) {
if (vdef->name) bctbx_free(vdef->name);
}
static void _linphone_video_definition_clone(LinphoneVideoDefinition *obj, const LinphoneVideoDefinition *orig){
obj->name = bctbx_strdup(orig->name);
obj->width = orig->width;
obj->height = orig->height;
}
belle_sip_error_code _linphone_video_definition_marshal(const LinphoneVideoDefinition* obj, char* buff, size_t buff_size, size_t *offset){
return belle_sip_snprintf(buff,buff_size,offset,"%s",obj->name);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneVideoDefinition);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneVideoDefinition, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_video_definition_destroy,
NULL, // clone
NULL, // marshal
TRUE
(belle_sip_object_clone_t)_linphone_video_definition_clone, // clone
(belle_sip_object_marshal_t)_linphone_video_definition_marshal, // marshal
FALSE
);
......@@ -67,7 +77,7 @@ void linphone_video_definition_set_user_data(LinphoneVideoDefinition *vdef, void
}
LinphoneVideoDefinition * linphone_video_definition_clone(const LinphoneVideoDefinition *vdef) {
return linphone_video_definition_new(linphone_video_definition_get_width(vdef), linphone_video_definition_get_height(vdef), linphone_video_definition_get_name(vdef));
return (LinphoneVideoDefinition*)belle_sip_object_clone((belle_sip_object_t*)vdef);
}
unsigned int linphone_video_definition_get_width(const LinphoneVideoDefinition *vdef) {
......
......@@ -427,6 +427,9 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr
BC_ASSERT_FALSE(wait_for_until(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_caller.number_of_LinphoneCallStreamsRunning+2,2000));
BC_ASSERT_FALSE(wait_for_until(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_callee.number_of_LinphoneCallStreamsRunning+2,2000));
}else{
/*wait a bit for streams to start flowing*/
wait_for_until(callee_mgr->lc,caller_mgr->lc, NULL, 0, 500);
}
if (linphone_core_get_media_encryption(caller_mgr->lc) == LinphoneMediaEncryptionDTLS ) {
if (linphone_core_get_current_call(caller_mgr->lc)->audiostream)
......@@ -739,6 +742,7 @@ static void call_outbound_with_multiple_proxy(void) {
// calling marie should go through the second proxy config
BC_ASSERT_TRUE(call(marie, pauline));
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
end_call(marie, pauline);
linphone_core_manager_destroy(marie);
......@@ -994,6 +998,7 @@ static void simple_call_compatibility_mode(void) {
BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,1));
wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,3);
wait_for_until(lc_pauline,lc_marie,NULL,0, 1000);
end_call(pauline, marie);
}
linphone_core_manager_destroy(marie);
......@@ -1032,6 +1037,7 @@ static void terminate_call_with_error(void) {
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(ei), "Call refused for security reason");
BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(ei), "SIP");
}
wait_for_until(caller_mgr->lc, callee_mgr->lc, NULL, 0, 1000);
linphone_call_terminate_with_error_info(out_call,ei);
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallReleased,1));
......@@ -1134,6 +1140,8 @@ static void cancel_other_device_after_accept(void) {
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallReleased,1));
wait_for_until(caller_mgr->lc,callee_mgr_2->lc,NULL,0,500);
rei = linphone_call_get_error_info(call_callee_2);
BC_ASSERT_PTR_NOT_NULL(rei);
if (rei){
......@@ -1305,7 +1313,7 @@ static void cancelled_ringing_call(void) {
const bctbx_list_t * call_history;
LinphoneCall* out_call;
char * db_path= bctbx_strdup_printf("%s,%s",bc_tester_get_writable_dir_prefix(),"tmp_call_log.db");
char * db_path= bc_tester_file("tmp_call_log.db");
linphone_core_set_call_logs_database_path(marie->lc,db_path);
......@@ -2505,7 +2513,7 @@ static void call_with_privacy(void) {
BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d");
}
liblinphone_tester_check_rtcp(pauline, marie);
end_call(pauline, marie);
/*test proxy config privacy*/
......@@ -2565,7 +2573,7 @@ static void call_with_privacy2(void) {
BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d");
}
liblinphone_tester_check_rtcp(pauline,marie);
end_call(pauline, marie);
/*test proxy config privacy*/
......@@ -2583,6 +2591,7 @@ static void call_with_privacy2(void) {
BC_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity));
BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d");
}
liblinphone_tester_check_rtcp(pauline,marie);
end_call(marie, pauline);
linphone_core_manager_destroy(marie);
......
......@@ -180,12 +180,12 @@ static void profile_call_base(bool_t avpf1
}else {
ms_message("Unsupported [%s] encryption type, cannot test",linphone_media_encryption_to_string(srtp2));
goto end;
}
BC_ASSERT_TRUE(call(marie, pauline));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); /*wait 1 second for streams to start flowing*/
if (linphone_core_get_current_call(marie->lc)) {
params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc));
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
......@@ -453,6 +453,7 @@ static void compatible_avpf_features(void) {
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); /*wait 1 second for streams to start flowing*/
check_avpf_features(marie->lc, pt->avpf.features);
check_avpf_features(pauline->lc, pt->avpf.features);
......@@ -477,6 +478,7 @@ static void incompatible_avpf_features(void) {
if (!call_ok) goto end;
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); /*wait 1 second for streams to start flowing*/
check_avpf_features(marie->lc, PAYLOAD_TYPE_AVPF_NONE);
check_avpf_features(pauline->lc, PAYLOAD_TYPE_AVPF_NONE);
......