From 8acd143a7a152885b815999162660fd4e7a3f247 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 12 Nov 2014 12:59:53 +0800 Subject: [PATCH] fix #194: refine the timeout recv, pulse to 500ms. 2.0.14. --- README.md | 7 +++++-- trunk/src/app/srs_app_rtmp_conn.cpp | 12 ++---------- trunk/src/core/srs_core.hpp | 2 +- trunk/src/kernel/srs_kernel_consts.hpp | 6 +++--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8f4a7943ed..1ac7efbdd7 100755 --- a/README.md +++ b/README.md @@ -242,6 +242,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v2.0, 2014-11-08, fix [#194](https://github.com/winlinvip/simple-rtmp-server/issues/194), optmized st for timeout recv. pulse to 500ms. 2.0.14. * v2.0, 2014-11-08, fix [#195](https://github.com/winlinvip/simple-rtmp-server/issues/195), remove the confuse code st_usleep(0). 2.0.13. * v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp-project and --export-librtmp-single. 2.0.11. * v2.0, 2014-11-08, fix [#66](https://github.com/winlinvip/simple-rtmp-server/issues/66), srs-librtmp support write h264 raw packet. 2.0.9. @@ -442,10 +443,12 @@ Supported operating systems and hardware: Performance benchmark history, on virtual box: -* 2013-11-28, SRS 0.5.0, 1800clients, 90%CPU, 41MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/023e23bc8261bec15a70a7ae932098fb4f82b679) +* 2013-11-28, SRS 0.5.0, 1800clients, 90%CPU, 41MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/023e23bc8261bec15a70a7ae932098fb4f82b679) * 2014-07-12, SRS 0.9.156, 1800clients, 68%CPU, 38MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/e2d273f4939348374bf9644df9d54c4293b39c1a) * 2014-07-12, SRS 0.9.156, 2700clients, 89%CPU, 61MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/6d12280b7cc54c465b1caf8b1402149e77c4c7d9) -* 2014-11-11, SRS 1.0.5/2.0.12, 2700clients, 85%CPU, 66MB. +* 2014-11-11, SRS 1.0.5, 2700clients, 85%CPU, 66MB. (1.0 equals 2.0.12) +* 2014-11-12, SRS 2.0.14, 2700clients, 69%CPU, 59MB. +* 2014-11-12, SRS 2.0.14, 3500clients, 95%CPU, 78MB. Latest benchmark(2014-07-12): diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index f26eeab5da..53f4661865 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -516,10 +516,7 @@ int SrsRtmpConn::playing(SrsSource* source) SrsAutoFree(SrsConsumer, consumer); srs_verbose("consumer created success."); - // TODO: FIXME: remove following. rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US); - //rtmp->set_recv_timeout(ST_UTIME_NO_TIMEOUT); - //rtmp->set_send_timeout(ST_UTIME_NO_TIMEOUT); // initialize other components SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER); @@ -531,6 +528,8 @@ int SrsRtmpConn::playing(SrsSource* source) // collect elapse for pithy print. pithy_print.elapse(); + // read message when no data to send. + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/194 // read from client. if (true) { SrsMessage* msg = NULL; @@ -561,13 +560,6 @@ int SrsRtmpConn::playing(SrsSource* source) srs_error("get messages from consumer failed. ret=%d", ret); return ret; } - - // no data, sleep a while. - // for the poll_fd maybe not active, and no message. - // @see: https://github.com/winlinvip/simple-rtmp-server/issues/194 - //if (count <= 0) { - // st_usleep(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US); - //} // reportable if (pithy_print.can_print()) { diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 0e7e612c39..9d6dbc9e12 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -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 13 +#define VERSION_REVISION 14 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server" diff --git a/trunk/src/kernel/srs_kernel_consts.hpp b/trunk/src/kernel/srs_kernel_consts.hpp index 3f66203ef7..defc2d556c 100644 --- a/trunk/src/kernel/srs_kernel_consts.hpp +++ b/trunk/src/kernel/srs_kernel_consts.hpp @@ -67,18 +67,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // the following is the timeout for rtmp protocol, // to avoid death connection. -// the timeout to wait client data, +// the timeout to send data to client, // if timeout, close the connection. #define SRS_CONSTS_RTMP_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL) -// the timeout to send data to client, +// the timeout to wait client data, // if timeout, close the connection. #define SRS_CONSTS_RTMP_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL) // the timeout to wait for client control message, // if timeout, we generally ignore and send the data to client, // generally, it's the pulse time for data seding. -#define SRS_CONSTS_RTMP_PULSE_TIMEOUT_US (int64_t)(200*1000LL) +#define SRS_CONSTS_RTMP_PULSE_TIMEOUT_US (int64_t)(500*1000LL) /** * max rtmp header size: