Changeset 2293 for pjproject/trunk
- Timestamp:
- Sep 18, 2008 12:58:33 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/transport.h
r2291 r2293 494 494 495 495 /** 496 * Remote address where RTP/RTCP originated from. 497 */ 498 pj_sockaddr rem_rtp_name; 499 pj_sockaddr rem_rtcp_name; 496 * Remote address where RTP/RTCP originated from. In case this transport 497 * hasn't ever received packet, the 498 */ 499 pj_sockaddr src_rtp_name; 500 pj_sockaddr src_rtcp_name; 500 501 501 502 /** -
pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
r2291 r2293 1425 1425 } 1426 1426 1427 /* Get remote address originating RTP & RTCP. */ 1428 info->rem_rtp_name = tp_ice->rtp_src_addr; 1429 info->rem_rtcp_name = tp_ice->rtcp_src_addr; 1427 /* Set remote address originating RTP & RTCP if this transport has 1428 * received any packets. 1429 */ 1430 if (tp_ice->rtp_src_cnt) { 1431 info->src_rtp_name = tp_ice->rtp_src_addr; 1432 info->src_rtcp_name = tp_ice->rtcp_src_addr; 1433 } 1430 1434 1431 1435 return PJ_SUCCESS; … … 1455 1459 tp_ice->addr_len = addr_len; 1456 1460 1461 /* Init source RTP & RTCP addresses and counter */ 1462 tp_ice->rtp_src_addr = tp_ice->remote_rtp; 1463 tp_ice->rtcp_src_addr = tp_ice->remote_rtcp; 1464 tp_ice->rtp_src_cnt = 0; 1465 1457 1466 return PJ_SUCCESS; 1458 1467 } … … 1551 1560 * have been received. 1552 1561 */ 1553 if (!tp_ice->use_ice && 1554 pj_sockaddr_cmp(&tp_ice->remote_rtp, src_addr) != 0 ) 1555 { 1556 /* Check if the source address is recognized. */ 1557 if (pj_sockaddr_cmp(src_addr, &tp_ice->rtp_src_addr) != 0) { 1558 /* Remember the new source address. */ 1559 pj_sockaddr_cp(&tp_ice->rtp_src_addr, src_addr); 1560 1561 /* Reset counter */ 1562 tp_ice->rtp_src_cnt = 0; 1563 } 1564 1565 tp_ice->rtp_src_cnt++; 1566 1567 if ((tp_ice->options & PJMEDIA_ICE_NO_SRC_ADDR_CHECKING) == 0 && 1568 tp_ice->rtp_src_cnt >= PJMEDIA_RTP_NAT_PROBATION_CNT) 1569 { 1570 1571 char addr_text[80]; 1572 1573 /* Set remote RTP address to source address */ 1574 pj_sockaddr_cp(&tp_ice->remote_rtp, &tp_ice->rtp_src_addr); 1575 tp_ice->addr_len = pj_sockaddr_get_len(&tp_ice->remote_rtp); 1576 1577 /* Reset counter */ 1578 tp_ice->rtp_src_cnt = 0; 1579 1580 PJ_LOG(4,(tp_ice->base.name, 1581 "Remote RTP address switched to %s", 1582 pj_sockaddr_print(&tp_ice->remote_rtp, addr_text, 1583 sizeof(addr_text), 3))); 1584 1585 /* Also update remote RTCP address if actual RTCP source 1586 * address is not heard yet. 1587 */ 1588 if (!pj_sockaddr_has_addr(&tp_ice->rtcp_src_addr)) { 1589 pj_uint16_t port; 1590 1591 pj_sockaddr_cp(&tp_ice->remote_rtcp, &tp_ice->remote_rtp); 1592 1593 port = (pj_uint16_t) 1594 (pj_sockaddr_get_port(&tp_ice->remote_rtp)+1); 1595 pj_sockaddr_set_port(&tp_ice->remote_rtcp, port); 1562 if (!tp_ice->use_ice) { 1563 1564 /* Increment counter and avoid zero */ 1565 if (++tp_ice->rtp_src_cnt == 0) 1566 tp_ice->rtp_src_cnt = 1; 1567 1568 if (pj_sockaddr_cmp(&tp_ice->remote_rtp, src_addr) != 0) { 1569 1570 /* Check if the source address is recognized. */ 1571 if (pj_sockaddr_cmp(src_addr, &tp_ice->rtp_src_addr) != 0) { 1572 /* Remember the new source address. */ 1573 pj_sockaddr_cp(&tp_ice->rtp_src_addr, src_addr); 1574 /* Reset counter */ 1575 tp_ice->rtp_src_cnt = 0; 1576 } 1577 1578 if ((tp_ice->options & PJMEDIA_ICE_NO_SRC_ADDR_CHECKING)==0 && 1579 tp_ice->rtp_src_cnt >= PJMEDIA_RTP_NAT_PROBATION_CNT) 1580 { 1581 char addr_text[80]; 1582 1583 /* Set remote RTP address to source address */ 1584 pj_sockaddr_cp(&tp_ice->remote_rtp, &tp_ice->rtp_src_addr); 1585 tp_ice->addr_len = pj_sockaddr_get_len(&tp_ice->remote_rtp); 1586 1587 /* Reset counter */ 1588 tp_ice->rtp_src_cnt = 0; 1596 1589 1597 1590 PJ_LOG(4,(tp_ice->base.name, 1598 "Remote RT CP address switched to %s",1599 pj_sockaddr_print(&tp_ice->remote_rt cp, addr_text,1591 "Remote RTP address switched to %s", 1592 pj_sockaddr_print(&tp_ice->remote_rtp, addr_text, 1600 1593 sizeof(addr_text), 3))); 1601 1594 1595 /* Also update remote RTCP address if actual RTCP source 1596 * address is not heard yet. 1597 */ 1598 if (!pj_sockaddr_has_addr(&tp_ice->rtcp_src_addr)) { 1599 pj_uint16_t port; 1600 1601 pj_sockaddr_cp(&tp_ice->remote_rtcp, 1602 &tp_ice->remote_rtp); 1603 1604 port = (pj_uint16_t) 1605 (pj_sockaddr_get_port(&tp_ice->remote_rtp)+1); 1606 pj_sockaddr_set_port(&tp_ice->remote_rtcp, port); 1607 1608 PJ_LOG(4,(tp_ice->base.name, 1609 "Remote RTCP address switched to %s", 1610 pj_sockaddr_print(&tp_ice->remote_rtcp, 1611 addr_text, 1612 sizeof(addr_text), 3))); 1613 } 1602 1614 } 1603 1615 } -
pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c
r2291 r2293 607 607 608 608 /* Get remote address originating RTP & RTCP. */ 609 info-> rem_rtp_name = udp->rtp_src_addr;610 info-> rem_rtcp_name = udp->rtcp_src_addr;609 info->src_rtp_name = udp->rtp_src_addr; 610 info->src_rtcp_name = udp->rtcp_src_addr; 611 611 612 612 return PJ_SUCCESS; … … 666 666 udp->attached = PJ_TRUE; 667 667 668 /* Reset source RTP & RTCP addresses and counter */ 669 pj_bzero(&udp->rtp_src_addr, sizeof(udp->rtp_src_addr)); 670 pj_bzero(&udp->rtcp_src_addr, sizeof(udp->rtcp_src_addr)); 671 udp->rtp_src_cnt = 0; 672 668 673 return PJ_SUCCESS; 669 674 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2291 r2293 2048 2048 //rem_addr = pj_sockaddr_print(&info.stream_info[i].rem_addr, 2049 2049 // rem_addr_buf, sizeof(rem_addr_buf), 3); 2050 if (pj_sockaddr_has_addr(&tp_info. rem_rtp_name)) {2051 rem_addr = pj_sockaddr_print(&tp_info. rem_rtp_name, rem_addr_buf,2050 if (pj_sockaddr_has_addr(&tp_info.src_rtp_name)) { 2051 rem_addr = pj_sockaddr_print(&tp_info.src_rtp_name, rem_addr_buf, 2052 2052 sizeof(rem_addr_buf), 3); 2053 2053 } else { 2054 2054 pj_ansi_snprintf(rem_addr_buf, sizeof(rem_addr_buf), "-"); 2055 rem_addr = rem_addr_buf; 2055 2056 } 2056 2057
Note: See TracChangeset
for help on using the changeset viewer.