]> sjero.net Git - linphone/commitdiff
Copy ICE check list pointers between media descriptions.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 19 Jul 2012 07:43:28 +0000 (09:43 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 19 Jul 2012 13:03:27 +0000 (15:03 +0200)
coreapi/linphonecall.c
coreapi/misc.c
coreapi/offeranswer.c

index c36b341ecbfe8950e1dfc0538f0a641b139f8bbe..28bc348b21f3779f83a089f9fbb24508f1b866f6 100644 (file)
@@ -249,6 +249,12 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
                        md->streams[i].ice_check_list = ice_check_list_new();
                        ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list);
                }
+               if ((call->dir == LinphoneCallIncoming) && (sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list != NULL)) {
+                       md->streams[i].ice_check_list = sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list;
+               }
+       }
+       if ((call->dir == LinphoneCallIncoming) && (md->streams[0].ice_check_list != NULL)) {
+               call->ice_session=md->streams[0].ice_check_list->session;
        }
        
        linphone_address_destroy(addr);
@@ -391,8 +397,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
        linphone_call_init_common(call, from, to);
        linphone_core_init_default_params(lc, &call->params);
        call->params.has_video &= !!lc->video_policy.automatically_accept;
-       if (sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list != NULL)
-               call->ice_session=sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list->session;
        call->localdesc=create_local_media_description (lc,call);
        call->camera_active=call->params.has_video;
        switch (linphone_core_get_firewall_policy(call->core)) {
@@ -969,7 +973,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){
        }
        if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){
                rtp_session_set_pktinfo(audiostream->session,TRUE);
-               audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list;
+               if (call->dir == LinphoneCallOutgoing) audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list;
+               else audiostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list;
                ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream);
        }
 
@@ -994,7 +999,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){
                }
                if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){
                        rtp_session_set_pktinfo(call->videostream->session,TRUE);
-                       call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list;
+                       if (call->dir == LinphoneCallOutgoing) call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list;
+                       else call->videostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[1].ice_check_list;
                        ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream);
                }
                call->videostream_app_evq = ortp_ev_queue_new();
index f7e6feb64c6757bbcdec8ef563e46b1f6997a191..2ef0e04bf6b981f60fe74e4dc952abc45e248711 100644 (file)
@@ -600,14 +600,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
        video_responses[0] = video_responses[1] = FALSE;
        audio_ice_bases[0] = audio_ice_bases[1] = NULL;
        video_ice_bases[0] = video_ice_bases[1] = NULL;
-       if (call->dir == LinphoneCallOutgoing) {
-               audio_check_list = call->localdesc->streams[0].ice_check_list;
-               video_check_list = call->localdesc->streams[1].ice_check_list;
-       } else {
-               SalMediaDescription *md = sal_call_get_remote_media_description(call->op);
-               audio_check_list = md->streams[0].ice_check_list;
-               video_check_list = md->streams[1].ice_check_list;
-       }
+       audio_check_list = call->localdesc->streams[0].ice_check_list;
+       video_check_list = call->localdesc->streams[1].ice_check_list;
        audio_socks[0] = create_socket(call->audio_port);
        if (audio_socks[0] == -1) return;
        audio_socks[1] = create_socket(call->audio_port + 1);
index 5a2b4f5275ab90c4f5533cf973acbdfe1d1b6571..7b6ce018fb185f24605922423e964725d1ca0202 100644 (file)
@@ -223,6 +223,7 @@ static void initiate_outgoing(const SalStreamDescription *local_offer,
                if (!match_crypto_algo(local_offer->crypto, remote_answer->crypto, &result->crypto[0], &result->crypto_local_tag, FALSE))
                        result->port = 0;
        }
+       result->ice_check_list = remote_answer->ice_check_list;
 }
 
 
@@ -249,6 +250,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap,
                        result->port = 0; 
                
        }
+       result->ice_check_list = local_cap->ice_check_list;
 }
 
 /**
@@ -309,6 +311,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities
                        if (rs->type==SalOther){
                                strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1);
                        }
+                       result->streams[i].ice_check_list = remote_offer->streams[i].ice_check_list;
                }
        }
        result->nstreams=i;