@@ -58,6 +58,8 @@ using namespace std;
58
58
59
59
#endif
60
60
61
+ #include < srs_app_config.hpp>
62
+
61
63
#ifdef SRS_AUTO_HTTP_SERVER
62
64
63
65
SrsStreamCache::SrsStreamCache (SrsSource* s, SrsRequest* r)
@@ -484,7 +486,12 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
484
486
if (srs_string_ends_with (entry->pattern , " .flv" )) {
485
487
w->header ()->set_content_type (" video/x-flv" );
486
488
#ifdef SRS_PERF_FAST_FLV_ENCODER
487
- enc = new SrsFastFlvStreamEncoder ();
489
+ bool realtime = _srs_config->get_realtime_enabled (req->vhost );
490
+ if (realtime) {
491
+ enc = new SrsFlvStreamEncoder ();
492
+ } else {
493
+ enc = new SrsFastFlvStreamEncoder ();
494
+ }
488
495
#else
489
496
enc = new SrsFlvStreamEncoder ();
490
497
#endif
@@ -542,6 +549,8 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
542
549
SrsHttpMessage* hr = dynamic_cast <SrsHttpMessage*>(r);
543
550
SrsResponseOnlyHttpConn* hc = dynamic_cast <SrsResponseOnlyHttpConn*>(hr->connection ());
544
551
552
+ int mw_sleep = _srs_config->get_mw_sleep_ms (req->vhost );
553
+
545
554
SrsHttpRecvThread* trd = new SrsHttpRecvThread (hc);
546
555
SrsAutoFree (SrsHttpRecvThread, trd);
547
556
@@ -570,15 +579,15 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
570
579
if (count <= 0 ) {
571
580
srs_info (" http: sleep %dms for no msg" , SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
572
581
// directly use sleep, donot use consumer wait.
573
- st_usleep (SRS_CONSTS_RTMP_PULSE_TIMEOUT_US );
582
+ st_usleep (mw_sleep );
574
583
575
584
// ignore when nothing got.
576
585
continue ;
577
586
}
578
587
579
588
if (pprint->can_print ()) {
580
- srs_info (" -> " SRS_CONSTS_LOG_HTTP_STREAM" http: got %d msgs, age=%d, min=%d, mw=%d" ,
581
- count, pprint->age (), SRS_PERF_MW_MIN_MSGS, SRS_CONSTS_RTMP_PULSE_TIMEOUT_US / 1000 );
589
+ srs_trace (" -> " SRS_CONSTS_LOG_HTTP_STREAM" http: got %d msgs, age=%d, min=%d, mw=%d" ,
590
+ count, pprint->age (), SRS_PERF_MW_MIN_MSGS, mw_sleep );
582
591
}
583
592
584
593
// sendout all messages.
0 commit comments