Changeset 4345 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Feb 13, 2013 7:43:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r4343 r4345 2249 2249 #if PJSUA_MEDIA_HAS_PJMEDIA || PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO 2250 2250 2251 static pj_bool_t is_ice_running(pjmedia_transport *tp) 2252 { 2253 pjmedia_transport_info tpinfo; 2254 pjmedia_ice_transport_info *ice_info; 2255 2256 pjmedia_transport_info_init(&tpinfo); 2257 pjmedia_transport_get_info(tp, &tpinfo); 2258 ice_info = (pjmedia_ice_transport_info*) 2259 pjmedia_transport_info_get_spc_info(&tpinfo, 2260 PJMEDIA_TRANSPORT_TYPE_ICE); 2261 return (ice_info && ice_info->sess_state == PJ_ICE_STRANS_STATE_RUNNING); 2262 } 2263 2264 2251 2265 static pj_bool_t is_media_changed(const pjsua_call *call, 2252 2266 unsigned med_idx, … … 2288 2302 } 2289 2303 2290 /* Compare remote RTP address */ 2291 if (pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 2304 /* Compare remote RTP address. If ICE is running, change in default 2305 * address can happen after negotiation, this can be handled 2306 * internally by ICE and does not need to cause media restart. 2307 */ 2308 if (!is_ice_running(call_med->tp) && 2309 pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 2310 { 2292 2311 return PJ_TRUE; 2312 } 2293 2313 2294 2314 /* Compare codec info */ … … 2344 2364 } 2345 2365 2346 /* Compare remote RTP address */ 2347 if (pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 2366 /* Compare remote RTP address. If ICE is running, change in default 2367 * address can happen after negotiation, this can be handled 2368 * internally by ICE and does not need to cause media restart. 2369 */ 2370 if (!is_ice_running(call_med->tp) && 2371 pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 2372 { 2348 2373 return PJ_TRUE; 2374 } 2349 2375 2350 2376 /* Compare codec info */ … … 2555 2581 } else { 2556 2582 pjmedia_transport_info tp_info; 2583 pjmedia_srtp_info *srtp_info; 2557 2584 2558 2585 /* Start/restart media transport based on info in SDP */ … … 2573 2600 pjmedia_transport_info_init(&tp_info); 2574 2601 pjmedia_transport_get_info(call_med->tp, &tp_info); 2575 if (tp_info.specific_info_cnt > 0) { 2576 unsigned i; 2577 for (i = 0; i < tp_info.specific_info_cnt; ++i) { 2578 if (tp_info.spc_info[i].type == 2579 PJMEDIA_TRANSPORT_TYPE_SRTP) 2580 { 2581 pjmedia_srtp_info *srtp_info = 2582 (pjmedia_srtp_info*)tp_info.spc_info[i].buffer; 2583 2584 call_med->rem_srtp_use = srtp_info->peer_use; 2585 break; 2586 } 2587 } 2602 srtp_info = (pjmedia_srtp_info*) 2603 pjmedia_transport_info_get_spc_info( 2604 &tp_info, PJMEDIA_TRANSPORT_TYPE_SRTP); 2605 if (srtp_info) { 2606 call_med->rem_srtp_use = srtp_info->peer_use; 2588 2607 } 2589 2608 … … 2692 2711 } else { 2693 2712 pjmedia_transport_info tp_info; 2713 pjmedia_srtp_info *srtp_info; 2694 2714 2695 2715 /* Start/restart media transport */ … … 2710 2730 pjmedia_transport_info_init(&tp_info); 2711 2731 pjmedia_transport_get_info(call_med->tp, &tp_info); 2712 if (tp_info.specific_info_cnt > 0) { 2713 unsigned i; 2714 for (i = 0; i < tp_info.specific_info_cnt; ++i) { 2715 if (tp_info.spc_info[i].type == 2716 PJMEDIA_TRANSPORT_TYPE_SRTP) 2717 { 2718 pjmedia_srtp_info *sri; 2719 sri=(pjmedia_srtp_info*)tp_info.spc_info[i].buffer; 2720 call_med->rem_srtp_use = sri->peer_use; 2721 break; 2722 } 2723 } 2732 srtp_info = (pjmedia_srtp_info*) 2733 pjmedia_transport_info_get_spc_info( 2734 &tp_info, PJMEDIA_TRANSPORT_TYPE_SRTP); 2735 if (srtp_info) { 2736 call_med->rem_srtp_use = srtp_info->peer_use; 2724 2737 } 2725 2738
Note: See TracChangeset
for help on using the changeset viewer.