正在显示
2 个修改的文件
包含
10 行增加
和
6 行删除
@@ -433,17 +433,21 @@ void SrsPublishRecvThread::set_socket_buffer(int sleep_ms) | @@ -433,17 +433,21 @@ void SrsPublishRecvThread::set_socket_buffer(int sleep_ms) | ||
433 | // 2000*5000/8=1250000B(about 1220KB). | 433 | // 2000*5000/8=1250000B(about 1220KB). |
434 | int kbps = 5000; | 434 | int kbps = 5000; |
435 | int socket_buffer_size = sleep_ms * kbps / 8; | 435 | int socket_buffer_size = sleep_ms * kbps / 8; |
436 | + | ||
437 | + int fd = mr_fd; | ||
438 | + int onb_rbuf = 0; | ||
439 | + socklen_t sock_buf_size = sizeof(int); | ||
440 | + getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &onb_rbuf, &sock_buf_size); | ||
436 | 441 | ||
437 | // socket recv buffer, system will double it. | 442 | // socket recv buffer, system will double it. |
438 | int nb_rbuf = socket_buffer_size / 2; | 443 | int nb_rbuf = socket_buffer_size / 2; |
439 | - socklen_t sock_buf_size = sizeof(int); | ||
440 | - if (setsockopt(mr_fd, SOL_SOCKET, SO_RCVBUF, &nb_rbuf, sock_buf_size) < 0) { | 444 | + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &nb_rbuf, sock_buf_size) < 0) { |
441 | srs_warn("set sock SO_RCVBUF=%d failed.", nb_rbuf); | 445 | srs_warn("set sock SO_RCVBUF=%d failed.", nb_rbuf); |
442 | } | 446 | } |
443 | - getsockopt(mr_fd, SOL_SOCKET, SO_RCVBUF, &nb_rbuf, &sock_buf_size); | 447 | + getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &nb_rbuf, &sock_buf_size); |
444 | 448 | ||
445 | - srs_trace("merged read sockbuf=%d, actual=%d, sleep %d when nread<=%d", | ||
446 | - socket_buffer_size, nb_rbuf, sleep_ms, SRS_MR_SMALL_BYTES); | 449 | + srs_trace("mr change sleep %d=>%d, erbuf=%d, rbuf %d=>%d, sbytes=%d", |
450 | + mr_sleep, sleep_ms, socket_buffer_size, onb_rbuf, nb_rbuf, SRS_MR_SMALL_BYTES); | ||
447 | 451 | ||
448 | rtmp->set_recv_buffer(nb_rbuf); | 452 | rtmp->set_recv_buffer(nb_rbuf); |
449 | } | 453 | } |
@@ -1023,7 +1023,7 @@ void SrsRtmpConn::change_mw_sleep(int sleep_ms) | @@ -1023,7 +1023,7 @@ void SrsRtmpConn::change_mw_sleep(int sleep_ms) | ||
1023 | } | 1023 | } |
1024 | getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, &sock_buf_size); | 1024 | getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, &sock_buf_size); |
1025 | 1025 | ||
1026 | - srs_trace("mw changed %d=>%d, max_msgs=%d, esbuf=%d, sbuf %d=>%d", | 1026 | + srs_trace("mw change sleep %d=>%d, max_msgs=%d, esbuf=%d, sbuf %d=>%d", |
1027 | mw_sleep, sleep_ms, SRS_PERF_MW_MSGS, socket_buffer_size, | 1027 | mw_sleep, sleep_ms, SRS_PERF_MW_MSGS, socket_buffer_size, |
1028 | onb_sbuf, nb_sbuf); | 1028 | onb_sbuf, nb_sbuf); |
1029 | 1029 |
-
请 注册 或 登录 后发表评论