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/pjnath/src/pjnath/stun_sock.c

    r4537 r4538  
    238238        goto on_error; 
    239239 
     240    /* Apply socket buffer size */ 
     241    if (cfg->so_rcvbuf_size > 0) { 
     242        unsigned sobuf_size = cfg->so_rcvbuf_size; 
     243        status = pj_sock_setsockopt_sobuf(stun_sock->sock_fd, pj_SO_RCVBUF(), 
     244                                          PJ_TRUE, &sobuf_size); 
     245        if (status != PJ_SUCCESS) { 
     246            pj_perror(3, stun_sock->obj_name, status, 
     247                      "Failed setting SO_RCVBUF"); 
     248        } else { 
     249            if (sobuf_size < cfg->so_rcvbuf_size) { 
     250                PJ_LOG(4, (stun_sock->obj_name,  
     251                           "Warning! Cannot set SO_RCVBUF as configured, " 
     252                           "now=%d, configured=%d", 
     253                           sobuf_size, cfg->so_rcvbuf_size)); 
     254            } else { 
     255                PJ_LOG(5, (stun_sock->obj_name, "SO_RCVBUF set to %d", 
     256                           sobuf_size)); 
     257            } 
     258        } 
     259    } 
     260    if (cfg->so_sndbuf_size > 0) { 
     261        unsigned sobuf_size = cfg->so_sndbuf_size; 
     262        status = pj_sock_setsockopt_sobuf(stun_sock->sock_fd, pj_SO_SNDBUF(), 
     263                                          PJ_TRUE, &sobuf_size); 
     264        if (status != PJ_SUCCESS) { 
     265            pj_perror(3, stun_sock->obj_name, status, 
     266                      "Failed setting SO_SNDBUF"); 
     267        } else { 
     268            if (sobuf_size < cfg->so_sndbuf_size) { 
     269                PJ_LOG(4, (stun_sock->obj_name,  
     270                           "Warning! Cannot set SO_SNDBUF as configured, " 
     271                           "now=%d, configured=%d", 
     272                           sobuf_size, cfg->so_sndbuf_size)); 
     273            } else { 
     274                PJ_LOG(5, (stun_sock->obj_name, "SO_SNDBUF set to %d", 
     275                           sobuf_size)); 
     276            } 
     277        } 
     278    } 
     279 
    240280    /* Bind socket */ 
    241281    max_bind_retry = MAX_BIND_RETRY; 
Note: See TracChangeset for help on using the changeset viewer.