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/turn_sock.c

    r4537 r4538  
    811811        } 
    812812 
     813        /* Apply socket buffer size */ 
     814        if (turn_sock->setting.so_rcvbuf_size > 0) { 
     815            unsigned sobuf_size = turn_sock->setting.so_rcvbuf_size; 
     816            status = pj_sock_setsockopt_sobuf(sock, pj_SO_RCVBUF(), 
     817                                              PJ_TRUE, &sobuf_size); 
     818            if (status != PJ_SUCCESS) { 
     819                pj_perror(3, turn_sock->obj_name, status, 
     820                          "Failed setting SO_RCVBUF"); 
     821            } else { 
     822                if (sobuf_size < turn_sock->setting.so_rcvbuf_size) { 
     823                    PJ_LOG(4, (turn_sock->obj_name,  
     824                               "Warning! Cannot set SO_RCVBUF as configured," 
     825                               " now=%d, configured=%d", sobuf_size, 
     826                               turn_sock->setting.so_rcvbuf_size)); 
     827                } else { 
     828                    PJ_LOG(5, (turn_sock->obj_name, "SO_RCVBUF set to %d", 
     829                               sobuf_size)); 
     830                } 
     831            } 
     832        } 
     833        if (turn_sock->setting.so_sndbuf_size > 0) { 
     834            unsigned sobuf_size = turn_sock->setting.so_sndbuf_size; 
     835            status = pj_sock_setsockopt_sobuf(sock, pj_SO_SNDBUF(), 
     836                                              PJ_TRUE, &sobuf_size); 
     837            if (status != PJ_SUCCESS) { 
     838                pj_perror(3, turn_sock->obj_name, status, 
     839                          "Failed setting SO_SNDBUF"); 
     840            } else { 
     841                if (sobuf_size < turn_sock->setting.so_sndbuf_size) { 
     842                    PJ_LOG(4, (turn_sock->obj_name,  
     843                               "Warning! Cannot set SO_SNDBUF as configured," 
     844                               " now=%d, configured=%d", sobuf_size, 
     845                               turn_sock->setting.so_sndbuf_size)); 
     846                } else { 
     847                    PJ_LOG(5, (turn_sock->obj_name, "SO_SNDBUF set to %d", 
     848                               sobuf_size)); 
     849                } 
     850            } 
     851        } 
     852 
    813853        /* Create active socket */ 
    814854        pj_activesock_cfg_default(&asock_cfg); 
Note: See TracChangeset for help on using the changeset viewer.