Changeset 5597 for pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c
- Timestamp:
- Jun 3, 2017 9:22:34 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c
r5539 r5597 56 56 unsigned media_options; /**< Transport media options. */ 57 57 void *user_data; /**< Only valid when attached */ 58 pj_bool_t attached; /**< Has attachment? */58 //pj_bool_t attached; /**< Has attachment? */ 59 59 pj_sockaddr rem_rtp_addr; /**< Remote RTP address */ 60 unsigned rem_rtp_cnt; /**< How many pkt from this addr. */ 60 61 pj_sockaddr rem_rtcp_addr; /**< Remote RTCP address */ 61 62 int addr_len; /**< Length of addresses. */ … … 480 481 /* We're still receiving from rem_rtp_addr. Don't switch. */ 481 482 udp->rtp_src_cnt = 0; 483 udp->rem_rtp_cnt++; 482 484 } else { 483 485 udp->rtp_src_cnt++; 484 486 485 487 if (udp->rtp_src_cnt < PJMEDIA_RTP_NAT_PROBATION_CNT) { 486 discard = PJ_TRUE; 488 /* Only discard if we have ever received packet from 489 * remote address (rem_rtp_addr). 490 */ 491 //discard = PJ_TRUE; 492 discard = (udp->rem_rtp_cnt != 0); 487 493 } else { 488 494 … … 530 536 } 531 537 532 if (!discard && udp->attached && cb) 538 //if (!discard && udp->attached && cb) 539 if (!discard && cb) 533 540 (*cb)(user_data, udp->rtp_pkt, bytes_read); 534 541 … … 566 573 user_data = udp->user_data; 567 574 568 if (udp->attached && cb) 575 //if (udp->attached && cb) 576 if (cb) 569 577 (*cb)(user_data, udp->rtcp_pkt, bytes_read); 570 578 … … 650 658 651 659 /* Must not be "attached" to existing application */ 652 PJ_ASSERT_RETURN(!udp->attached, PJ_EINVALIDOP);660 //PJ_ASSERT_RETURN(!udp->attached, PJ_EINVALIDOP); 653 661 654 662 /* Lock the ioqueue keys to make sure that callbacks are … … 686 694 687 695 /* Last, mark transport as attached */ 688 udp->attached = PJ_TRUE;696 //udp->attached = PJ_TRUE; 689 697 690 698 /* Reset source RTP & RTCP addresses and counter */ … … 693 701 udp->rtp_src_cnt = 0; 694 702 udp->rtcp_src_cnt = 0; 703 udp->rem_rtp_cnt = 0; 695 704 696 705 /* Set buffer size for RTP socket */ … … 752 761 pj_assert(tp); 753 762 754 if (udp->attached) { 763 //if (udp->attached) { 764 if (1) { 755 765 int i; 756 766 … … 768 778 769 779 /* First, mark transport as unattached */ 770 udp->attached = PJ_FALSE;780 //udp->attached = PJ_FALSE; 771 781 772 782 /* Clear up application infos from transport */ … … 801 811 802 812 /* Must be attached */ 803 PJ_ASSERT_RETURN(udp->attached, PJ_EINVALIDOP);813 //PJ_ASSERT_RETURN(udp->attached, PJ_EINVALIDOP); 804 814 805 815 /* Check that the size is supported */ … … 862 872 pj_status_t status; 863 873 864 PJ_ASSERT_RETURN(udp->attached, PJ_EINVALIDOP);874 //PJ_ASSERT_RETURN(udp->attached, PJ_EINVALIDOP); 865 875 866 876 if (addr == NULL) {
Note: See TracChangeset
for help on using the changeset viewer.