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-02 19:28:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
463e1fbc4185405872c7814d22628bda3e572c73
463e1fbc
1 parent
24a6a723
for bug #237, refine the thread loop for publish thread. 2.0.47
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
30 行增加
和
32 行删除
trunk/src/app/srs_app_recv_thread.cpp
trunk/src/core/srs_core.hpp
trunk/src/app/srs_app_recv_thread.cpp
查看文件 @
463e1fb
...
...
@@ -66,29 +66,35 @@ int SrsRecvThread::cycle()
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
handler
->
can_handle
())
{
st_usleep
(
timeout
*
1000
);
return
ret
;
}
SrsMessage
*
msg
=
NULL
;
if
((
ret
=
rtmp
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"recv client control message failed. ret=%d"
,
ret
);
while
(
trd
->
can_loop
())
{
if
(
!
handler
->
can_handle
())
{
st_usleep
(
timeout
*
1000
);
continue
;
}
// we use no timeout to recv, should never got any error.
trd
->
stop_loop
();
SrsMessage
*
msg
=
NULL
;
// notice the handler got a recv error.
handler
->
on_recv_error
(
ret
);
return
ret
;
// recv and handle message
ret
=
rtmp
->
recv_message
(
&
msg
);
if
(
ret
==
ERROR_SUCCESS
)
{
ret
=
handler
->
handle
(
msg
);
}
if
(
ret
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"thread process message failed. ret=%d"
,
ret
);
}
// we use no timeout to recv, should never got any error.
trd
->
stop_loop
();
// notice the handler got a recv error.
handler
->
on_recv_error
(
ret
);
return
ret
;
}
srs_verbose
(
"thread loop recv message. ret=%d"
,
ret
);
}
srs_verbose
(
"play loop recv message. ret=%d"
,
ret
);
handler
->
handle
(
msg
);
return
ret
;
}
...
...
@@ -263,21 +269,13 @@ int SrsPublishRecvThread::handle(SrsMessage* msg)
_nb_msgs
++
;
// the rtmp connection will handle this message,
// quit the thread loop when error.
recv_error_code
=
ret
=
_conn
->
handle_publish_message
(
_source
,
msg
,
_is_fmle
,
_is_edge
);
// when error, use stop loop to terminate the thread normally,
// for we are in the thread loop now, and should never use stop() to terminate it.
if
(
ret
!=
ERROR_SUCCESS
)
{
trd
.
stop_loop
();
}
// the rtmp connection will handle this message
ret
=
_conn
->
handle_publish_message
(
_source
,
msg
,
_is_fmle
,
_is_edge
);
// must always free it,
// the source will copy it if need to use.
srs_freep
(
msg
);
// TODO: FIXME: implements it.
return
ret
;
}
...
...
trunk/src/core/srs_core.hpp
查看文件 @
463e1fb
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 4
6
#define VERSION_REVISION 4
7
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
请
注册
或
登录
后发表评论