]> sjero.net Git - linphone/commitdiff
Prevent crappy RTP and RTCP address if their extraction from ICE fails.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Wed, 22 Aug 2012 13:56:59 +0000 (15:56 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Wed, 22 Aug 2012 13:56:59 +0000 (15:56 +0200)
coreapi/misc.c

index 4292a6f179ccc2bc6c7075290d870d505214b075..a4db409d99134d5c1886508b19f59597d529a086 100644 (file)
@@ -612,6 +612,7 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription *
        IceSessionState session_state = ice_session_state(session);
        int nb_candidates;
        int i, j;
+       bool_t result;
 
        if (session_state == IS_Completed) {
                desc->ice_completed = TRUE;
@@ -630,11 +631,17 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription *
                if (cl == NULL) continue;
                if (cl->state == ICL_Completed) {
                        stream->ice_completed = TRUE;
-                       ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
+                       result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
+               } else {
+                       stream->ice_completed = FALSE;
+                       result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
+               }
+               if (result == TRUE) {
                        strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr));
                        strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr));
                } else {
-                       stream->ice_completed = FALSE;
+                       memset(stream->rtp_addr, 0, sizeof(stream->rtp_addr));
+                       memset(stream->rtcp_addr, 0, sizeof(stream->rtcp_addr));
                }
                if ((strlen(ice_check_list_local_pwd(cl)) != strlen(desc->ice_pwd)) || (strcmp(ice_check_list_local_pwd(cl), desc->ice_pwd)))
                        strncpy(stream->ice_pwd, ice_check_list_local_pwd(cl), sizeof(stream->ice_pwd));