mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 17:29:20 +00:00
fix memory leak and windows build
This commit is contained in:
parent
f5f2319462
commit
c88685b194
6 changed files with 30 additions and 22 deletions
|
|
@ -3743,7 +3743,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
|
|||
SalOp *replaced;
|
||||
SalMediaDescription *new_md;
|
||||
bool_t was_ringing=FALSE;
|
||||
MSList * iterator;
|
||||
MSList * iterator, *copy;
|
||||
|
||||
if (call==NULL){
|
||||
//if just one call is present answer the only one ...
|
||||
|
|
@ -3765,26 +3765,24 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
|
|||
}
|
||||
|
||||
|
||||
for (iterator=ms_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) {
|
||||
for (iterator=copy=ms_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) {
|
||||
LinphoneCall *a_call=(LinphoneCall*)iterator->data;
|
||||
if (a_call==call) continue;
|
||||
switch(a_call->state){
|
||||
case LinphoneCallOutgoingInit:
|
||||
case LinphoneCallOutgoingProgress:
|
||||
case LinphoneCallOutgoingRinging:
|
||||
case LinphoneCallOutgoingEarlyMedia:
|
||||
|
||||
ms_message("Already existing call [%p] in state [%s], canceling it before accepting new call [%p]" ,a_call
|
||||
,linphone_call_state_to_string(a_call->state)
|
||||
,call);
|
||||
case LinphoneCallOutgoingInit:
|
||||
case LinphoneCallOutgoingProgress:
|
||||
case LinphoneCallOutgoingRinging:
|
||||
case LinphoneCallOutgoingEarlyMedia:
|
||||
ms_message("Already existing call [%p] in state [%s], canceling it before accepting new call [%p]",a_call
|
||||
,linphone_call_state_to_string(a_call->state)
|
||||
,call);
|
||||
linphone_core_terminate_call(lc,a_call);
|
||||
break;
|
||||
default:
|
||||
break; /*nothing to do*/
|
||||
}
|
||||
|
||||
}
|
||||
if (iterator) ms_list_free(iterator);
|
||||
ms_list_free(copy);
|
||||
|
||||
/* check if this call is supposed to replace an already running one*/
|
||||
replaced=sal_call_get_replaces(call->op);
|
||||
|
|
@ -4191,7 +4189,7 @@ LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const c
|
|||
}
|
||||
return call;
|
||||
}
|
||||
LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, LinphoneAddress *raddr){
|
||||
LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const LinphoneAddress *raddr){
|
||||
MSList *elem=ms_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr);
|
||||
|
||||
if (elem) return (LinphoneCall*) elem->data;
|
||||
|
|
|
|||
|
|
@ -2247,7 +2247,7 @@ LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneC
|
|||
*
|
||||
* @ingroup call_control
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, LinphoneAddress *remote_address);
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const LinphoneAddress *remote_address);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call,
|
|||
|
||||
LINPHONE_PUBLIC int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call);
|
||||
void linphone_core_resolve_stun_server(LinphoneCore *lc);
|
||||
const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc);
|
||||
LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc);
|
||||
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params);
|
||||
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
|
||||
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ int sal_media_description_get_nb_active_streams(const SalMediaDescription *md) {
|
|||
return nb;
|
||||
}
|
||||
|
||||
|
||||
static bool_t is_null_address(const char *addr){
|
||||
return strcmp(addr,"0.0.0.0")==0 || strcmp(addr,"::0")==0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,22 +370,29 @@ static void call_forking_declined_localy(void){
|
|||
|
||||
static void call_forking_with_push_notification_single(void){
|
||||
MSList* lcs;
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(marie->lc, LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new2( "marie_rc", FALSE);
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new2( transport_supported(marie->lc, LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc",FALSE);
|
||||
int dummy=0;
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
linphone_proxy_config_set_contact_uri_parameters(
|
||||
linphone_core_get_default_proxy_config(marie->lc),
|
||||
"app-id=org.linphonetester;pn-tok=aaabbb;pn-type=apple;pn-msg-str=33;pn-call-str=34;");
|
||||
|
||||
lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneRegistrationOk,1,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneRegistrationOk,1,5000));
|
||||
|
||||
/*unfortunately marie gets unreachable due to crappy 3G operator or iOS bug...*/
|
||||
linphone_core_set_network_reachable(marie->lc,FALSE);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
|
||||
/*the server is expected to send a push notification to marie, this will wake up linphone, that will reconnect:*/
|
||||
/*After 5 seconds the server is expected to send a push notification to marie, this will wake up linphone, that will reconnect:*/
|
||||
wait_for_list(lcs,&dummy,1,6000);
|
||||
linphone_core_set_network_reachable(marie->lc,TRUE);
|
||||
|
||||
/*Marie shall receive the call immediately*/
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) {
|
|||
|
||||
/*work around a to avoid stun resolution to be initiate in call_received callback leading a mainloop reentrency*/
|
||||
/*
|
||||
belle_sip_main_loop_iterate() at belle_sip_loop.c:369
|
||||
belle_sip_main_loop_iterate() at belle_sip_loop.c:369
|
||||
belle_sip_main_loop_run [inlined]() at belle_sip_loop.c:478
|
||||
belle_sip_main_loop_sleep() at belle_sip_loop.c:490
|
||||
sal_iterate() at sal_impl.c:745
|
||||
|
|
@ -283,7 +283,11 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) {
|
|||
...
|
||||
linphone_core_iterate() at linphonecore.c:2 620
|
||||
...
|
||||
*/
|
||||
|
||||
linphone_core_set_stun_server() initiates an asynchronous resolution, but it needs a few iteration before it is completed.
|
||||
By calling private function linphone_core_get_stun_server_addrinfo() we make sure to wait that the resolution is done before the
|
||||
test calls actually start.
|
||||
*/
|
||||
linphone_core_get_stun_server_addrinfo(marie->lc);
|
||||
linphone_core_get_stun_server_addrinfo(pauline->lc);
|
||||
linphone_core_get_stun_server_addrinfo(laure->lc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue