- Timestamp:
- Feb 13, 2013 7:43:32 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/transport.h
r3664 r4345 567 567 * 568 568 * @param tp The transport. 569 * @param info Media socket info to be initialized.569 * @param info Media transport info to be initialized. 570 570 * 571 571 * @return PJ_SUCCESS on success. … … 578 578 579 579 return PJ_ENOTSUP; 580 } 581 582 583 /** 584 * Utility API to get transport type specific info from the specified media 585 * transport info. 586 * 587 * @param info Media transport info. 588 * @param type Media transport type. 589 * 590 * @return Pointer to media transport specific info, or NULL if 591 * specific info for the transport type is not found. 592 */ 593 PJ_INLINE(void*) pjmedia_transport_info_get_spc_info( 594 pjmedia_transport_info *info, 595 pjmedia_transport_type type) 596 { 597 unsigned i; 598 for (i = 0; i < info->specific_info_cnt; ++i) { 599 if (info->spc_info[i].type == type) 600 return (void*)info->spc_info[i].buffer; 601 } 602 return NULL; 580 603 } 581 604 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r4342 r4345 3060 3060 3061 3061 /* Check if ICE setup is complete and if it needs reinvite */ 3062 for (i = 0; i < call->med_cnt && ice_complete; ++i) {3062 for (i = 0; i < call->med_cnt; ++i) { 3063 3063 pjsua_call_media *call_med = &call->media[i]; 3064 3064 pjmedia_transport_info tpinfo; 3065 unsigned j;3065 pjmedia_ice_transport_info *ice_info; 3066 3066 3067 3067 if (call_med->tp_st == PJSUA_MED_TP_NULL || … … 3074 3074 pjmedia_transport_info_init(&tpinfo); 3075 3075 pjmedia_transport_get_info(call_med->tp, &tpinfo); 3076 for (j = 0; j < tpinfo.specific_info_cnt; ++j) { 3077 pjmedia_ice_transport_info *ice_info; 3078 3079 if (tpinfo.spc_info[j].type != PJMEDIA_TRANSPORT_TYPE_ICE) 3080 continue; 3081 3082 ice_info = (pjmedia_ice_transport_info*)tpinfo.spc_info[j].buffer; 3083 3084 /* Check if ICE setup not completed yet */ 3085 if (ice_info->sess_state < PJ_ICE_STRANS_STATE_RUNNING) { 3086 ice_complete = PJ_FALSE; 3087 break; 3076 ice_info = (pjmedia_ice_transport_info*) 3077 pjmedia_transport_info_get_spc_info( 3078 &tpinfo, PJMEDIA_TRANSPORT_TYPE_ICE); 3079 if (!ice_info) 3080 continue; 3081 3082 /* Check if ICE setup not completed yet */ 3083 if (ice_info->sess_state < PJ_ICE_STRANS_STATE_RUNNING) { 3084 ice_complete = PJ_FALSE; 3085 break; 3086 } 3087 3088 /* Check if ICE needs to send reinvite */ 3089 if (!ice_need_reinv && 3090 ice_info->sess_state == PJ_ICE_STRANS_STATE_RUNNING && 3091 ice_info->role == PJ_ICE_SESS_ROLE_CONTROLLING) 3092 { 3093 pjsua_ice_config *cfg=&pjsua_var.acc[call->acc_id].cfg.ice_cfg; 3094 if ((cfg->ice_always_update && !call->reinv_ice_sent) || 3095 pj_sockaddr_cmp(&tpinfo.sock_info.rtp_addr_name, 3096 &call_med->rtp_addr)) 3097 { 3098 ice_need_reinv = PJ_TRUE; 3088 3099 } 3089 3090 /* Check if ICE needs to send reinvite */3091 if (!ice_need_reinv &&3092 ice_info->sess_state == PJ_ICE_STRANS_STATE_RUNNING &&3093 ice_info->role == PJ_ICE_SESS_ROLE_CONTROLLING)3094 {3095 pjsua_ice_config *cfg=&pjsua_var.acc[call->acc_id].cfg.ice_cfg;3096 if ((cfg->ice_always_update && !call->reinv_ice_sent) ||3097 pj_sockaddr_cmp(&tpinfo.sock_info.rtp_addr_name,3098 &call_med->rtp_addr))3099 {3100 ice_need_reinv = PJ_TRUE;3101 }3102 }3103 break;3104 3100 } 3105 3101 } -
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.