Commit d3bd19d3 authored by Simon Morlat's avatar Simon Morlat
Browse files

implement RTP socket re-creation on the fly, in order to have RTP streams to...

implement RTP socket re-creation on the fly, in order to have RTP streams to follow the new routes defined by the system.
This is optional, done in linphone_core_set_network_reachable(lc, TRUE); when property recreate_sockets_when_network_is_up is set to 1 in [net] section of linphonerc.
parent b617434b
......@@ -4761,3 +4761,14 @@ void linphone_call_repair_if_broken(LinphoneCall *call){
break;
}
}
void linphone_call_refresh_sockets(LinphoneCall *call){
int i;
for (i=0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){
MSMediaStreamSessions *mss = &call->sessions[i];
if (mss->rtp_session){
rtp_session_refresh_sockets(mss->rtp_session);
}
}
}
......@@ -6458,6 +6458,9 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu
ms_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken);
}else{
linphone_core_resolve_stun_server(lc);
if (lp_config_get_int(lc->config, "net", "recreate_sockets_when_network_is_up", 0)){
ms_list_for_each(lc->calls, (MSIterateFunc)linphone_call_refresh_sockets);
}
}
#ifdef BUILD_UPNP
if(lc->upnp == NULL) {
......
......@@ -343,6 +343,7 @@ void linphone_call_log_completed(LinphoneCall *call);
void linphone_call_log_destroy(LinphoneCallLog *cl);
void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state);
LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
void linphone_call_refresh_sockets(LinphoneCall *call);
LinphoneCallParams * linphone_call_params_new(void);
SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params);
......
oRTP @ 5f7b669f
Subproject commit 816957041aa2711096ec77111d85a7865ec2877a
Subproject commit 5f7b669fec5b80f772001ca11b405a55c934713e
......@@ -5042,16 +5042,24 @@ static void call_record_with_custom_rtp_modifier(void) {
custom_rtp_modifier(FALSE, TRUE);
}
static void _call_with_network_switch(bool_t use_ice){
static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
MSList *lcs = NULL;
bool_t call_ok;
lcs = ms_list_append(lcs, marie->lc);
lcs = ms_list_append(lcs, pauline->lc);
if (use_ice){
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
}
if (with_socket_refresh){
lp_config_set_int(linphone_core_get_config(marie->lc), "net", "recreate_sockets_when_network_is_up", 1);
lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "recreate_sockets_when_network_is_up", 1);
}
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
if (!call_ok) goto end;
......@@ -5071,22 +5079,29 @@ static void _call_with_network_switch(bool_t use_ice){
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
/*check that media is back*/
check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid);
liblinphone_tester_check_rtcp(pauline, marie);
if (use_ice) BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
/*pauline shall be able to end the call without problem now*/
end_call(pauline, marie);
end:
ms_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_network_switch(void){
_call_with_network_switch(FALSE);
_call_with_network_switch(FALSE, FALSE);
}
static void call_with_network_switch_and_ice(void){
_call_with_network_switch(TRUE);
_call_with_network_switch(TRUE, FALSE);
}
static void call_with_network_switch_and_socket_refresh(void){
_call_with_network_switch(TRUE, TRUE);
}
#ifdef CALL_LOGS_STORAGE_ENABLED
......@@ -5453,7 +5468,8 @@ test_t call_tests[] = {
{ "Call paused resumed with custom RTP Modifier", call_paused_resumed_with_custom_rtp_modifier },
{ "Call record with custom RTP Modifier", call_record_with_custom_rtp_modifier },
{ "Call with network switch", call_with_network_switch },
{ "Call with network switch and ICE", call_with_network_switch_and_ice }
{ "Call with network switch and ICE", call_with_network_switch_and_ice },
{ "Call with network switch with socket refresh", call_with_network_switch_and_socket_refresh }
};
test_suite_t call_test_suite = {"Single Call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
......
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