@@ -58,6 +58,8 @@ using namespace std;
5858
5959#endif
6060
61+ #include < srs_app_config.hpp>
62+
6163#ifdef SRS_AUTO_HTTP_SERVER
6264
6365SrsStreamCache::SrsStreamCache (SrsSource* s, SrsRequest* r)
@@ -484,7 +486,12 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
484486 if (srs_string_ends_with (entry->pattern , " .flv" )) {
485487 w->header ()->set_content_type (" video/x-flv" );
486488#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+ }
488495#else
489496 enc = new SrsFlvStreamEncoder ();
490497#endif
@@ -542,6 +549,8 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
542549 SrsHttpMessage* hr = dynamic_cast <SrsHttpMessage*>(r);
543550 SrsResponseOnlyHttpConn* hc = dynamic_cast <SrsResponseOnlyHttpConn*>(hr->connection ());
544551
552+ int mw_sleep = _srs_config->get_mw_sleep_ms (req->vhost );
553+
545554 SrsHttpRecvThread* trd = new SrsHttpRecvThread (hc);
546555 SrsAutoFree (SrsHttpRecvThread, trd);
547556
@@ -570,15 +579,15 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
570579 if (count <= 0 ) {
571580 srs_info (" http: sleep %dms for no msg" , SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
572581 // directly use sleep, donot use consumer wait.
573- st_usleep (SRS_CONSTS_RTMP_PULSE_TIMEOUT_US );
582+ st_usleep (mw_sleep );
574583
575584 // ignore when nothing got.
576585 continue ;
577586 }
578587
579588 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 );
582591 }
583592
584593 // sendout all messages.
0 commit comments