winlin

Merge branch 'srs.master'

@@ -242,6 +242,7 @@ Supported operating systems and hardware: @@ -242,6 +242,7 @@ Supported operating systems and hardware:
242 * 2013-10-17, Created.<br/> 242 * 2013-10-17, Created.<br/>
243 243
244 ## History 244 ## History
  245 +* 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.
245 * 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. 246 * 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.
246 * 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. 247 * 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.
247 * 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. 248 * 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: @@ -442,10 +443,12 @@ Supported operating systems and hardware:
442 443
443 Performance benchmark history, on virtual box: 444 Performance benchmark history, on virtual box:
444 445
445 -* 2013-11-28, SRS 0.5.0, 1800clients, 90%CPU, 41MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/023e23bc8261bec15a70a7ae932098fb4f82b679) 446 +* 2013-11-28, SRS 0.5.0, 1800clients, 90%CPU, 41MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/023e23bc8261bec15a70a7ae932098fb4f82b679)
446 * 2014-07-12, SRS 0.9.156, 1800clients, 68%CPU, 38MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/e2d273f4939348374bf9644df9d54c4293b39c1a) 447 * 2014-07-12, SRS 0.9.156, 1800clients, 68%CPU, 38MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/e2d273f4939348374bf9644df9d54c4293b39c1a)
447 * 2014-07-12, SRS 0.9.156, 2700clients, 89%CPU, 61MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/6d12280b7cc54c465b1caf8b1402149e77c4c7d9) 448 * 2014-07-12, SRS 0.9.156, 2700clients, 89%CPU, 61MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/6d12280b7cc54c465b1caf8b1402149e77c4c7d9)
448 -* 2014-11-11, SRS 1.0.5/2.0.12, 2700clients, 85%CPU, 66MB. 449 +* 2014-11-11, SRS 1.0.5, 2700clients, 85%CPU, 66MB. (1.0 equals 2.0.12)
  450 +* 2014-11-12, SRS 2.0.14, 2700clients, 69%CPU, 59MB.
  451 +* 2014-11-12, SRS 2.0.14, 3500clients, 95%CPU, 78MB.
449 452
450 Latest benchmark(2014-07-12): 453 Latest benchmark(2014-07-12):
451 454
@@ -516,10 +516,7 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -516,10 +516,7 @@ int SrsRtmpConn::playing(SrsSource* source)
516 SrsAutoFree(SrsConsumer, consumer); 516 SrsAutoFree(SrsConsumer, consumer);
517 srs_verbose("consumer created success."); 517 srs_verbose("consumer created success.");
518 518
519 - // TODO: FIXME: remove following.  
520 rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US); 519 rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
521 - //rtmp->set_recv_timeout(ST_UTIME_NO_TIMEOUT);  
522 - //rtmp->set_send_timeout(ST_UTIME_NO_TIMEOUT);  
523 520
524 // initialize other components 521 // initialize other components
525 SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER); 522 SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER);
@@ -531,6 +528,8 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -531,6 +528,8 @@ int SrsRtmpConn::playing(SrsSource* source)
531 // collect elapse for pithy print. 528 // collect elapse for pithy print.
532 pithy_print.elapse(); 529 pithy_print.elapse();
533 530
  531 + // read message when no data to send.
  532 + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/194
534 // read from client. 533 // read from client.
535 if (true) { 534 if (true) {
536 SrsMessage* msg = NULL; 535 SrsMessage* msg = NULL;
@@ -561,13 +560,6 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -561,13 +560,6 @@ int SrsRtmpConn::playing(SrsSource* source)
561 srs_error("get messages from consumer failed. ret=%d", ret); 560 srs_error("get messages from consumer failed. ret=%d", ret);
562 return ret; 561 return ret;
563 } 562 }
564 -  
565 - // no data, sleep a while.  
566 - // for the poll_fd maybe not active, and no message.  
567 - // @see: https://github.com/winlinvip/simple-rtmp-server/issues/194  
568 - //if (count <= 0) {  
569 - // st_usleep(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);  
570 - //}  
571 563
572 // reportable 564 // reportable
573 if (pithy_print.can_print()) { 565 if (pithy_print.can_print()) {
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 13 34 +#define VERSION_REVISION 14
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"
@@ -67,18 +67,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -67,18 +67,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 // the following is the timeout for rtmp protocol, 67 // the following is the timeout for rtmp protocol,
68 // to avoid death connection. 68 // to avoid death connection.
69 69
70 -// the timeout to wait client data, 70 +// the timeout to send data to client,
71 // if timeout, close the connection. 71 // if timeout, close the connection.
72 #define SRS_CONSTS_RTMP_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL) 72 #define SRS_CONSTS_RTMP_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL)
73 73
74 -// the timeout to send data to client, 74 +// the timeout to wait client data,
75 // if timeout, close the connection. 75 // if timeout, close the connection.
76 #define SRS_CONSTS_RTMP_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL) 76 #define SRS_CONSTS_RTMP_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL)
77 77
78 // the timeout to wait for client control message, 78 // the timeout to wait for client control message,
79 // if timeout, we generally ignore and send the data to client, 79 // if timeout, we generally ignore and send the data to client,
80 // generally, it's the pulse time for data seding. 80 // generally, it's the pulse time for data seding.
81 -#define SRS_CONSTS_RTMP_PULSE_TIMEOUT_US (int64_t)(200*1000LL) 81 +#define SRS_CONSTS_RTMP_PULSE_TIMEOUT_US (int64_t)(500*1000LL)
82 82
83 /** 83 /**
84 * max rtmp header size: 84 * max rtmp header size: