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 15:21:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
757cffbabf44338b18e1e8231d8f05458e12b003
757cffba
1 parent
b28dc736
for bug #237, when recv thread failed, quit the cycle. 2.0.44
显示空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
41 行增加
和
2 行删除
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/core/srs_core.hpp
trunk/src/app/srs_app_recv_thread.cpp
查看文件 @
757cffb
...
...
@@ -81,6 +81,9 @@ int SrsRecvThread::cycle()
// 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
(
"play loop recv message. ret=%d"
,
ret
);
...
...
@@ -122,6 +125,7 @@ void SrsRecvThread::on_thread_stop()
SrsQueueRecvThread
::
SrsQueueRecvThread
(
SrsRtmpServer
*
rtmp_sdk
,
int
timeout_ms
)
:
trd
(
this
,
rtmp_sdk
,
timeout_ms
)
{
recv_error_code
=
ERROR_SUCCESS
;
}
SrsQueueRecvThread
::~
SrsQueueRecvThread
()
...
...
@@ -168,6 +172,11 @@ SrsMessage* SrsQueueRecvThread::pump()
return
msg
;
}
int
SrsQueueRecvThread
::
error_code
()
{
return
recv_error_code
;
}
bool
SrsQueueRecvThread
::
can_handle
()
{
// we only recv one message and then process it,
...
...
@@ -186,6 +195,11 @@ int SrsQueueRecvThread::handle(SrsMessage* msg)
return
ERROR_SUCCESS
;
}
void
SrsQueueRecvThread
::
on_recv_error
(
int
ret
)
{
recv_error_code
=
ret
;
}
SrsPublishRecvThread
::
SrsPublishRecvThread
(
SrsRtmpServer
*
rtmp_sdk
,
int
timeout_ms
,
SrsRtmpConn
*
conn
,
SrsSource
*
source
,
bool
is_fmle
,
bool
is_edge
...
...
@@ -254,3 +268,8 @@ int SrsPublishRecvThread::handle(SrsMessage* msg)
// TODO: FIXME: implements it.
return
ret
;
}
void
SrsPublishRecvThread
::
on_recv_error
(
int
ret
)
{
recv_error_code
=
ret
;
}
...
...
trunk/src/app/srs_app_recv_thread.hpp
查看文件 @
757cffb
...
...
@@ -59,6 +59,10 @@ public:
* process the received message.
*/
virtual
int
handle
(
SrsMessage
*
msg
)
=
0
;
/**
* when recv message error.
*/
virtual
void
on_recv_error
(
int
ret
)
=
0
;
};
/**
...
...
@@ -95,6 +99,8 @@ class SrsQueueRecvThread : public ISrsMessageHandler
private
:
std
::
vector
<
SrsMessage
*>
queue
;
SrsRecvThread
trd
;
// the recv thread error code.
int
recv_error_code
;
public
:
SrsQueueRecvThread
(
SrsRtmpServer
*
rtmp_sdk
,
int
timeout_ms
);
virtual
~
SrsQueueRecvThread
();
...
...
@@ -105,9 +111,11 @@ public:
virtual
bool
empty
();
virtual
int
size
();
virtual
SrsMessage
*
pump
();
virtual
int
error_code
();
public
:
virtual
bool
can_handle
();
virtual
int
handle
(
SrsMessage
*
msg
);
virtual
void
on_recv_error
(
int
ret
);
};
/**
...
...
@@ -139,6 +147,7 @@ public:
public
:
virtual
bool
can_handle
();
virtual
int
handle
(
SrsMessage
*
msg
);
virtual
void
on_recv_error
(
int
ret
);
};
#endif
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
757cffb
...
...
@@ -558,13 +558,21 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
srs_verbose
(
"pump client message to process."
);
if
((
ret
=
process_play_control_msg
(
consumer
,
msg
))
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_system_control_error
(
ret
))
{
if
(
!
srs_is_system_control_error
(
ret
)
&&
!
srs_is_client_gracefully_close
(
ret
)
)
{
srs_error
(
"process play control message failed. ret=%d"
,
ret
);
}
return
ret
;
}
}
// quit when recv thread error.
if
((
ret
=
trd
->
error_code
())
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"recv thread failed. ret=%d"
,
ret
);
}
return
ret
;
}
// collect elapse for pithy print.
pithy_print
.
elapse
();
...
...
@@ -744,6 +752,9 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd)
// check the thread error code.
if
((
ret
=
trd
->
error_code
())
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"recv thread failed. ret=%d"
,
ret
);
}
return
ret
;
}
}
...
...
trunk/src/core/srs_core.hpp
查看文件 @
757cffb
...
...
@@ -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
3
#define VERSION_REVISION 4
4
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
请
注册
或
登录
后发表评论