diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 2afade7b0..16fb038c3 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -141,6 +141,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia if ((md_changed & ( SAL_MEDIA_DESCRIPTION_CODEC_CHANGED |SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED |SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED + |SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED |SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION ))){ ms_message("Media descriptions are different, need to restart the streams."); } else if ( call->playing_ringbacktone) { diff --git a/coreapi/sal.c b/coreapi/sal.c index e25c80103..976951697 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -325,6 +325,10 @@ int sal_stream_description_equals(const SalStreamDescription *sd1, const SalStre if (sd1->ptime != sd2->ptime) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; if (sd1->dir != sd2->dir) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + /* ICE */ + if (sd1->ice_ufrag != sd2->ice_ufrag) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED; + if (sd1->ice_pwd != sd2->ice_pwd) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED; + /*DTLS*/ if (sd1->dtls_role != sd2->dtls_role) result |= SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED; if (strcmp(sd1->dtls_fingerprint, sd2->dtls_fingerprint) != 0) result |= SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED; @@ -341,6 +345,11 @@ int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaD result |= SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED; if (md1->nb_streams != md2->nb_streams) result |= SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED; if (md1->bandwidth != md2->bandwidth) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; + + /* ICE */ + if (md1->ice_ufrag != md2->ice_ufrag) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED; + if (md1->ice_pwd != md2->ice_pwd) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED; + for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){ if (!sal_stream_description_active(&md1->streams[i]) && !sal_stream_description_active(&md2->streams[i])) continue; result |= sal_stream_description_equals(&md1->streams[i], &md2->streams[i]); diff --git a/include/sal/sal.h b/include/sal/sal.h index 72c47d2dd..648f74b02 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -76,6 +76,7 @@ typedef enum { #define SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED (1<<4) #define SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED (1<<5) /* use to notify when switching from multicast to unicast*/ #define SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION (1<<6) /* use force graph reconstruction*/ +#define SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED (1<<7) diff --git a/tester/call_tester.c b/tester/call_tester.c index a43968e3b..636a5c0f9 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -4783,11 +4783,9 @@ static void call_with_network_switch(void){ _call_with_network_switch(FALSE); } -#if 0 static void call_with_network_switch_and_ice(void){ _call_with_network_switch(TRUE); } -#endif #ifdef CALL_LOGS_STORAGE_ENABLED @@ -5105,11 +5103,8 @@ test_t call_tests[] = { { "Call with custom RTP Modifier", call_with_custom_rtp_modifier }, { "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 } -#if 0 - , + { "Call with network switch", call_with_network_switch }, { "Call with network switch and ICE", call_with_network_switch_and_ice } -#endif }; test_suite_t call_test_suite = {"Single Call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,