Ignore:
Timestamp:
Jun 19, 2013 9:06:55 AM (7 years ago)
Author:
nanang
Message:

Close #1681:

  • Added compile-time settings PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE and PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE. The default values are both 64 KB when PJMEDIA_HAS_VIDEO is set, otherwise just zero (socket buffer size uses OS default). The settings will be applied to media transport UDP and ICE.
  • Also added run-time settings so_sndbuf_size and so_rcvbuf_size into ICE stream transport, STUN socket, and TURN socket. Default values are all zero.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c

    r4197 r4538  
    694694    udp->rtcp_src_cnt = 0; 
    695695 
     696    /* Set buffer size for RTP socket */ 
     697#if PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE 
     698    { 
     699        unsigned sobuf_size = PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE; 
     700        pj_status_t status; 
     701        status = pj_sock_setsockopt_sobuf(udp->rtp_sock, pj_SO_RCVBUF(), 
     702                                          PJ_TRUE, &sobuf_size); 
     703        if (status != PJ_SUCCESS) { 
     704            pj_perror(3, tp->name, status, "Failed setting SO_RCVBUF"); 
     705        } else { 
     706            if (sobuf_size < PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE) { 
     707                PJ_LOG(4, (tp->name,  
     708                           "Warning! Cannot set SO_RCVBUF as configured, " 
     709                           "now=%d, configured=%d", 
     710                           sobuf_size, PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE)); 
     711            } else { 
     712                PJ_LOG(5, (tp->name, "SO_RCVBUF set to %d", sobuf_size)); 
     713            } 
     714        } 
     715    } 
     716#endif 
     717#if PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE 
     718    { 
     719        unsigned sobuf_size = PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE; 
     720        pj_status_t status; 
     721        status = pj_sock_setsockopt_sobuf(udp->rtp_sock, pj_SO_SNDBUF(), 
     722                                          PJ_TRUE, &sobuf_size); 
     723        if (status != PJ_SUCCESS) { 
     724            pj_perror(3, tp->name, status, "Failed setting SO_SNDBUF"); 
     725        } else { 
     726            if (sobuf_size < PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE) { 
     727                PJ_LOG(4, (tp->name,  
     728                           "Warning! Cannot set SO_SNDBUF as configured, " 
     729                           "now=%d, configured=%d", 
     730                           sobuf_size, PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE)); 
     731            } else { 
     732                PJ_LOG(5, (tp->name, "SO_SNDBUF set to %d", sobuf_size)); 
     733            } 
     734        } 
     735    } 
     736#endif 
     737 
    696738    /* Unlock keys */ 
    697739    pj_ioqueue_unlock_key(udp->rtcp_key); 
Note: See TracChangeset for help on using the changeset viewer.