Changeset 4346
- Timestamp:
- Feb 13, 2013 8:20:33 AM (12 years ago)
- Location:
- pjproject/branches/1.x
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjmedia/include/pjmedia/transport.h
r3553 r4346 534 534 * 535 535 * @param tp The transport. 536 * @param info Media socket info to be initialized.536 * @param info Media transport info to be initialized. 537 537 * 538 538 * @return PJ_SUCCESS on success. … … 545 545 546 546 return PJ_ENOTSUP; 547 } 548 549 550 /** 551 * Utility API to get transport type specific info from the specified media 552 * transport info. 553 * 554 * @param info Media transport info. 555 * @param type Media transport type. 556 * 557 * @return Pointer to media transport specific info, or NULL if 558 * specific info for the transport type is not found. 559 */ 560 PJ_INLINE(void*) pjmedia_transport_info_get_spc_info( 561 pjmedia_transport_info *info, 562 pjmedia_transport_type type) 563 { 564 unsigned i; 565 for (i = 0; i < info->specific_info_cnt; ++i) { 566 if (info->spc_info[i].type == type) 567 return (void*)info->spc_info[i].buffer; 568 } 569 return NULL; 547 570 } 548 571 -
pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_media.c
r4338 r4346 858 858 pjmedia_transport_info tpinfo; 859 859 pjmedia_ice_transport_info *ii = NULL; 860 unsigned i;861 860 862 861 pjmedia_transport_info_init(&tpinfo); 863 862 pjmedia_transport_get_info(tp, &tpinfo); 864 for (i=0; i<tpinfo.specific_info_cnt; ++i) { 865 if (tpinfo.spc_info[i].type==PJMEDIA_TRANSPORT_TYPE_ICE) { 866 ii = (pjmedia_ice_transport_info*) 867 tpinfo.spc_info[i].buffer; 868 break; 869 } 870 } 871 863 ii = (pjmedia_ice_transport_info*) 864 pjmedia_transport_info_get_spc_info( 865 &tpinfo, PJMEDIA_TRANSPORT_TYPE_ICE); 872 866 if (ii && ii->role==PJ_ICE_SESS_ROLE_CONTROLLING && 873 867 pj_sockaddr_cmp(&tpinfo.sock_info.rtp_addr_name, … … 1587 1581 1588 1582 1583 static pj_bool_t is_ice_running(pjmedia_transport *tp) 1584 { 1585 pjmedia_transport_info tpinfo; 1586 pjmedia_ice_transport_info *ice_info; 1587 1588 pjmedia_transport_info_init(&tpinfo); 1589 pjmedia_transport_get_info(tp, &tpinfo); 1590 ice_info = (pjmedia_ice_transport_info*) 1591 pjmedia_transport_info_get_spc_info(&tpinfo, 1592 PJMEDIA_TRANSPORT_TYPE_ICE); 1593 return (ice_info && ice_info->sess_state == PJ_ICE_STRANS_STATE_RUNNING); 1594 } 1595 1596 1589 1597 static pj_bool_t is_media_changed(const pjsua_call *call, 1590 1598 int new_audio_idx, … … 1626 1634 return PJ_TRUE; 1627 1635 1628 /* Compare remote RTP address */ 1629 if (pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 1636 /* Compare remote RTP address. If ICE is running, change in default 1637 * address can happen after negotiation, this can be handled 1638 * internally by ICE and does not need to cause media restart. 1639 */ 1640 if (!is_ice_running(call->med_tp) && 1641 pj_sockaddr_cmp(&old_si->rem_addr, &new_si->rem_addr)) 1642 { 1630 1643 return PJ_TRUE; 1644 } 1631 1645 1632 1646 /* Compare codec info */ … … 1921 1935 } else { 1922 1936 pjmedia_transport_info tp_info; 1937 pjmedia_srtp_info *srtp_info; 1923 1938 1924 1939 /* Start/restart media transport */ … … 1935 1950 pjmedia_transport_info_init(&tp_info); 1936 1951 pjmedia_transport_get_info(call->med_tp, &tp_info); 1937 if (tp_info.specific_info_cnt > 0) { 1938 unsigned i; 1939 for (i = 0; i < tp_info.specific_info_cnt; ++i) { 1940 if (tp_info.spc_info[i].type == PJMEDIA_TRANSPORT_TYPE_SRTP) 1941 { 1942 pjmedia_srtp_info *srtp_info = 1943 (pjmedia_srtp_info*) tp_info.spc_info[i].buffer; 1944 1945 call->rem_srtp_use = srtp_info->peer_use; 1946 break; 1947 } 1948 } 1952 srtp_info = (pjmedia_srtp_info*) 1953 pjmedia_transport_info_get_spc_info( 1954 &tp_info, PJMEDIA_TRANSPORT_TYPE_SRTP); 1955 if (srtp_info) { 1956 call->rem_srtp_use = srtp_info->peer_use; 1949 1957 } 1950 1958
Note: See TracChangeset
for help on using the changeset viewer.