mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
Add some checks in the TURN tests + add test of TURN with rtcp-mux.
This commit is contained in:
parent
015e7e7861
commit
e664b73e68
4 changed files with 45 additions and 18 deletions
|
|
@ -635,6 +635,10 @@ void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable) {
|
|||
lc->forced_ice_relay = enable;
|
||||
}
|
||||
|
||||
void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable) {
|
||||
lc->short_turn_refresh = enable;
|
||||
}
|
||||
|
||||
static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1) {
|
||||
LinphoneProxyConfig *proxy = NULL;
|
||||
const LinphoneNatPolicy *nat_policy = NULL;
|
||||
|
|
@ -712,6 +716,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
|
|||
linphone_core_notify_display_status(lc, _("ICE local candidates gathering in progress..."));
|
||||
|
||||
ice_session_enable_forced_relay(call->ice_session, lc->forced_ice_relay);
|
||||
ice_session_enable_short_turn_refresh(call->ice_session, lc->short_turn_refresh);
|
||||
|
||||
// TODO: Handle IPv6
|
||||
/* Gather local host candidates. */
|
||||
|
|
|
|||
|
|
@ -505,6 +505,7 @@ LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(Li
|
|||
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params);
|
||||
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable);
|
||||
LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable);
|
||||
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
|
||||
void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
|
||||
void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result);
|
||||
|
|
@ -980,7 +981,7 @@ struct _LinphoneCore
|
|||
bool_t vtables_running;
|
||||
bool_t send_call_stats_periodical_updates;
|
||||
bool_t forced_ice_relay;
|
||||
bool_t pad;
|
||||
bool_t short_turn_refresh;
|
||||
char localip[LINPHONE_IPADDR_SIZE];
|
||||
int device_rotation;
|
||||
int max_calls;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 1d9ededc3a45372b6e2ba4b8b6052edbdfadc450
|
||||
Subproject commit bdf34ccb02acb99f6ac7996a6d5e625d34dd47cf
|
||||
|
|
@ -108,9 +108,23 @@ static void configure_nat_policy(LinphoneCore *lc, bool_t turn_enabled) {
|
|||
linphone_auth_info_destroy(auth_info);
|
||||
}
|
||||
|
||||
static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled) {
|
||||
static void check_turn_context_statistics(MSTurnContext *turn_context, bool_t forced_relay) {
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_successful_allocate > 1);
|
||||
if (forced_relay == TRUE) {
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_send_indication > 0);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_data_indication > 0);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_received_channel_msg > 0);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_sent_channel_msg > 0);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_successful_refresh > 0);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_successful_create_permission > 1);
|
||||
BC_ASSERT_TRUE(turn_context->stats.nb_successful_channel_bind > 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled) {
|
||||
LinphoneCoreManager *marie;
|
||||
LinphoneCoreManager *pauline;
|
||||
LinphoneCall *lcall;
|
||||
LinphoneIceState expected_ice_state = LinphoneIceStateHostConnection;
|
||||
MSList *lcs = NULL;
|
||||
|
||||
|
|
@ -124,8 +138,14 @@ static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled,
|
|||
if (forced_relay == TRUE) {
|
||||
linphone_core_enable_forced_ice_relay(marie->lc, TRUE);
|
||||
linphone_core_enable_forced_ice_relay(pauline->lc, TRUE);
|
||||
linphone_core_enable_short_turn_refresh(marie->lc, TRUE);
|
||||
linphone_core_enable_short_turn_refresh(pauline->lc, TRUE);
|
||||
expected_ice_state = LinphoneIceStateRelayConnection;
|
||||
}
|
||||
if (rtcp_mux_enabled == TRUE) {
|
||||
lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1);
|
||||
lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1);
|
||||
}
|
||||
|
||||
BC_ASSERT_TRUE(call(marie, pauline));
|
||||
|
||||
|
|
@ -137,18 +157,14 @@ static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled,
|
|||
check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInactive);
|
||||
check_media_direction(pauline, linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInactive);
|
||||
liblinphone_tester_check_rtcp(marie, pauline);
|
||||
if (forced_relay == TRUE) {
|
||||
LinphoneCall *call = linphone_core_get_current_call(marie->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(call->ice_session);
|
||||
if (call->ice_session != NULL) {
|
||||
IceCheckList *cl = ice_session_check_list(call->ice_session, 0);
|
||||
BC_ASSERT_PTR_NOT_NULL(cl);
|
||||
if (cl != NULL) {
|
||||
BC_ASSERT_TRUE(cl->rtp_turn_context->stats_nb_send_indication > 0);
|
||||
BC_ASSERT_TRUE(cl->rtp_turn_context->stats_nb_data_indication > 0);
|
||||
BC_ASSERT_TRUE(cl->rtp_turn_context->stats_nb_received_channel_msg > 0);
|
||||
BC_ASSERT_TRUE(cl->rtp_turn_context->stats_nb_sent_channel_msg > 0);
|
||||
}
|
||||
lcall = linphone_core_get_current_call(marie->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(lcall->ice_session);
|
||||
if (lcall->ice_session != NULL) {
|
||||
IceCheckList *cl = ice_session_check_list(lcall->ice_session, 0);
|
||||
BC_ASSERT_PTR_NOT_NULL(cl);
|
||||
if (cl != NULL) {
|
||||
check_turn_context_statistics(cl->rtp_turn_context, forced_relay);
|
||||
if (!rtcp_mux_enabled) check_turn_context_statistics(cl->rtcp_turn_context, forced_relay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,15 +176,19 @@ static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled,
|
|||
}
|
||||
|
||||
static void basic_ice_turn_call(void) {
|
||||
ice_turn_call_base(FALSE, TRUE, TRUE);
|
||||
ice_turn_call_base(FALSE, TRUE, TRUE, FALSE);
|
||||
}
|
||||
|
||||
static void relayed_ice_turn_call(void) {
|
||||
ice_turn_call_base(TRUE, TRUE, TRUE);
|
||||
ice_turn_call_base(TRUE, TRUE, TRUE, FALSE);
|
||||
}
|
||||
|
||||
static void relayed_ice_turn_call_with_rtcp_mux(void) {
|
||||
ice_turn_call_base(TRUE, TRUE, TRUE, TRUE);
|
||||
}
|
||||
|
||||
static void relayed_ice_turn_to_ice_stun_call(void) {
|
||||
ice_turn_call_base(TRUE, TRUE, FALSE);
|
||||
ice_turn_call_base(TRUE, TRUE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -177,6 +197,7 @@ test_t stun_tests[] = {
|
|||
TEST_ONE_TAG("STUN encode", linphone_stun_test_encode, "STUN"),
|
||||
TEST_TWO_TAGS("Basic ICE+TURN call", basic_ice_turn_call, "ICE", "TURN"),
|
||||
TEST_TWO_TAGS("Relayed ICE+TURN call", relayed_ice_turn_call, "ICE", "TURN"),
|
||||
TEST_TWO_TAGS("Relayed ICE+TURN call with rtcp-mux", relayed_ice_turn_call_with_rtcp_mux, "ICE", "TURN"),
|
||||
TEST_TWO_TAGS("Relayed ICE+TURN to ICE+STUN call", relayed_ice_turn_to_ice_stun_call, "ICE", "TURN")
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue