Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-12-04 09:10:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
315f981821e08f8f8a3acbc0b254dc0230e58c22
315f9818
1 parent
d1d6023c
refine for bug #241, increase the small bytes for merged read.
显示空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
19 行增加
和
19 行删除
trunk/src/app/srs_app_recv_thread.cpp
trunk/src/qt/srs/srs-qt.pro.user
trunk/src/rtmp/srs_protocol_buffer.cpp
trunk/src/rtmp/srs_protocol_buffer.hpp
trunk/src/app/srs_app_recv_thread.cpp
查看文件 @
315f981
...
...
@@ -37,14 +37,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_MR_AVERAGE_BITRATE_KBPS 1000
#define SRS_MR_MIN_BITRATE_KBPS 32
// the max sleep time in ms
#define SRS_MR_MAX_SLEEP_MS
30
00
#define SRS_MR_MAX_SLEEP_MS
25
00
// the max small bytes to group
#define SRS_MR_SMALL_BYTES
64
#define SRS_MR_SMALL_BYTES
4096
// the percent of buffer to set as small bytes
#define SRS_MR_SMALL_PERCENT 100
// set the socket buffer to specified KB.
// the underlayer api will set to 2*SRS_MR_SOCKET_BUFFER KB.
#define SRS_MR_SOCKET_BUFFER 32
// set the socket buffer to specified bytes.
// the underlayer api will set to SRS_MR_SOCKET_BUFFER bytes.
#define SRS_MR_SOCKET_BUFFER SOCKET_READ_SIZE
ISrsMessageHandler
::
ISrsMessageHandler
()
{
...
...
@@ -299,15 +299,15 @@ void SrsPublishRecvThread::on_thread_start()
// we donot set the auto response to false,
// for the main thread never send message.
// socket recv buffer.
int
nb_rbuf
=
SRS_MR_SOCKET_BUFFER
*
1024
;
// socket recv buffer, system will double it.
int
nb_rbuf
=
SRS_MR_SOCKET_BUFFER
/
2
;
socklen_t
sock_buf_size
=
sizeof
(
int
);
if
(
setsockopt
(
mr_fd
,
SOL_SOCKET
,
SO_RCVBUF
,
&
nb_rbuf
,
sock_buf_size
)
<
0
)
{
srs_warn
(
"set sock SO_RCVBUF=%d failed."
,
nb_rbuf
);
}
getsockopt
(
mr_fd
,
SOL_SOCKET
,
SO_RCVBUF
,
&
nb_rbuf
,
&
sock_buf_size
);
srs_trace
(
"set socket buffer to %d, actual %d KB"
,
SRS_MR_SOCKET_BUFFER
,
nb_rbuf
/
1024
);
srs_trace
(
"set socket buffer to %d, actual %d KB"
,
SRS_MR_SOCKET_BUFFER
/
1024
,
nb_rbuf
/
1024
);
// enable the merge read
// @see https://github.com/winlinvip/simple-rtmp-server/issues/241
...
...
@@ -381,7 +381,7 @@ void SrsPublishRecvThread::on_buffer_change(int nb_buffer)
// set percent.
mr_small_bytes
=
(
int
)(
nb_buffer
/
SRS_MR_SMALL_PERCENT
);
// select the smaller
mr_small_bytes
=
srs_m
in
(
mr_small_bytes
,
SRS_MR_SMALL_BYTES
);
mr_small_bytes
=
srs_m
ax
(
mr_small_bytes
,
SRS_MR_SMALL_BYTES
);
// the recv sleep is [buffer / max_kbps, buffer / min_kbps]
// for example, buffer is 256KB, max kbps is 10Mbps, min kbps is 10Kbps,
...
...
trunk/src/qt/srs/srs-qt.pro.user
100644 → 100755
查看文件 @
315f981
trunk/src/rtmp/srs_protocol_buffer.cpp
查看文件 @
315f981
...
...
@@ -27,16 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_log.hpp>
#include <srs_kernel_utility.hpp>
// 4KB=4096
// 8KB=8192
// 16KB=16384
// 32KB=32768
// 64KB=65536
// @see https://github.com/winlinvip/simple-rtmp-server/issues/241
#define SOCKET_READ_SIZE 65536
// the max buffer for user space socket buffer.
#define SOCKET_MAX_BUF 65536
IMergeReadHandler
::
IMergeReadHandler
()
{
}
...
...
trunk/src/rtmp/srs_protocol_buffer.hpp
查看文件 @
315f981
...
...
@@ -34,6 +34,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_io.hpp>
// 4KB=4096
// 8KB=8192
// 16KB=16384
// 32KB=32768
// 64KB=65536
// @see https://github.com/winlinvip/simple-rtmp-server/issues/241
#define SOCKET_READ_SIZE 65536
// the max buffer for user space socket buffer.
#define SOCKET_MAX_BUF SOCKET_READ_SIZE
/**
* to improve read performance, merge some packets then read,
* when it on and read small bytes, we sleep to wait more data.,
...
...
请
注册
或
登录
后发表评论