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-11-22 18:08:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3e81e6e0f1d96305b0c4d2baebc1be007912f0a4
3e81e6e0
1 parent
5408169b
refine code for bug #217, use recv thread to set the timeout.
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
29 行增加
和
16 行删除
trunk/src/app/srs_app_recv_thread.cpp
trunk/src/app/srs_app_recv_thread.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_recv_thread.cpp
查看文件 @
3e81e6e
...
...
@@ -96,3 +96,27 @@ int SrsRecvThread::cycle()
return
ret
;
}
void
SrsRecvThread
::
on_thread_start
()
{
// the multiple messages writev improve performance large,
// but the timeout recv will cause 33% sys call performance,
// to use isolate thread to recv, can improve about 33% performance.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/194
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
rtmp
->
set_recv_timeout
(
ST_UTIME_NO_TIMEOUT
);
// disable the protocol auto response,
// for the isolate recv thread should never send any messages.
rtmp
->
set_auto_response
(
false
);
}
void
SrsRecvThread
::
on_thread_stop
()
{
// enable the protocol auto response,
// for the isolate recv thread terminated.
rtmp
->
set_auto_response
(
true
);
// reset the timeout to pulse mode.
rtmp
->
set_recv_timeout
(
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
);
}
...
...
trunk/src/app/srs_app_recv_thread.hpp
查看文件 @
3e81e6e
...
...
@@ -59,6 +59,9 @@ public:
virtual
int
start
();
virtual
void
stop
();
virtual
int
cycle
();
public
:
virtual
void
on_thread_start
();
virtual
void
on_thread_stop
();
};
#endif
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
3e81e6e
...
...
@@ -498,21 +498,11 @@ int SrsRtmpConn::playing(SrsSource* source)
{
int
ret
=
ERROR_SUCCESS
;
// the multiple messages writev improve performance large,
// but the timeout recv will cause 33% sys call performance,
// to use isolate thread to recv, can improve about 33% performance.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/194
// use isolate thread to recv,
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
//rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
rtmp
->
set_recv_timeout
(
ST_UTIME_NO_TIMEOUT
);
// disable the protocol auto response,
// for the isolate recv thread should never send any messages.
rtmp
->
set_auto_response
(
false
);
SrsRecvThread
trd
(
rtmp
);
// use isolate thread to recv,
// start isolate recv thread.
SrsRecvThread
trd
(
rtmp
);
if
((
ret
=
trd
.
start
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"start isolate recv thread failed. ret=%d"
,
ret
);
return
ret
;
...
...
@@ -524,10 +514,6 @@ int SrsRtmpConn::playing(SrsSource* source)
// stop isolate recv thread
trd
.
stop
();
// enable the protocol auto response,
// for the isolate recv thread terminated.
rtmp
->
set_auto_response
(
true
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论