1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #906, #902, remove the thread start and stop event

This commit is contained in:
winlin 2017-05-29 18:42:36 +08:00
parent 3ffb0980f5
commit b21f92f97a
12 changed files with 62 additions and 67 deletions

View file

@ -96,6 +96,29 @@ int SrsRecvThread::cycle()
{
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/ossrs/srs/issues/194
// @see: https://github.com/ossrs/srs/issues/217
rtmp->set_recv_timeout(SRS_CONSTS_NO_TMMS);
pumper->on_start();
ret = do_cycle();
// reset the timeout to pulse mode.
rtmp->set_recv_timeout(timeout * 1000);
pumper->on_stop();
return ret;
}
int SrsRecvThread::do_cycle()
{
int ret = ERROR_SUCCESS;
while (!trd->interrupted()) {
// When the pumper is interrupted, wait then retry.
if (pumper->interrupted()) {
@ -129,26 +152,6 @@ 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/ossrs/srs/issues/194
// @see: https://github.com/ossrs/srs/issues/217
rtmp->set_recv_timeout(SRS_CONSTS_NO_TMMS);
pumper->on_start();
}
void SrsRecvThread::on_thread_stop()
{
// reset the timeout to pulse mode.
rtmp->set_recv_timeout(timeout * 1000);
pumper->on_stop();
}
SrsQueueRecvThread::SrsQueueRecvThread(SrsConsumer* consumer, SrsRtmpServer* rtmp_sdk, int timeout_ms)
: trd(this, rtmp_sdk, timeout_ms)
{