Skip to content

Commit

Permalink
fix #194: refine the timeout recv, pulse to 500ms. 2.0.14.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 12, 2014
1 parent a6f3478 commit 8acd143
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/>

## 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.
Expand Down Expand Up @@ -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):

Expand Down
12 changes: 2 additions & 10 deletions trunk/src/app/srs_app_rtmp_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions trunk/src/kernel/srs_kernel_consts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8acd143

Please sign in to comment.