From 24a6a723eebcf97ac4aa6fc283514db9ec99fec0 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 19:22:06 +0800 Subject: [PATCH] for bug #237, never sleep when thread interval is 0. --- trunk/src/app/srs_app_recv_thread.hpp | 4 ++-- trunk/src/app/srs_app_thread.cpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/trunk/src/app/srs_app_recv_thread.hpp b/trunk/src/app/srs_app_recv_thread.hpp index 88e020bc1..95d46413b 100644 --- a/trunk/src/app/srs_app_recv_thread.hpp +++ b/trunk/src/app/srs_app_recv_thread.hpp @@ -129,9 +129,9 @@ public: }; /** - * the publish recv thread got message and callback the source method to process message. +* the publish recv thread got message and callback the source method to process message. * @see: https://github.com/winlinvip/simple-rtmp-server/issues/237 - */ +*/ class SrsPublishRecvThread : public ISrsMessageHandler { private: diff --git a/trunk/src/app/srs_app_thread.cpp b/trunk/src/app/srs_app_thread.cpp index 856ff5fa0..857f5fe8e 100644 --- a/trunk/src/app/srs_app_thread.cpp +++ b/trunk/src/app/srs_app_thread.cpp @@ -179,7 +179,11 @@ failed: break; } - st_usleep(cycle_interval_us); + // to improve performance, donot sleep when interval is zero. + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/237 + if (cycle_interval_us > 0) { + st_usleep(cycle_interval_us); + } } handler->on_thread_stop();