diff --git a/trunk/src/app/srs_app_dash.cpp b/trunk/src/app/srs_app_dash.cpp index 91fdf5045a..29bf527eee 100644 --- a/trunk/src/app/srs_app_dash.cpp +++ b/trunk/src/app/srs_app_dash.cpp @@ -743,6 +743,8 @@ srs_utime_t SrsDash::cleanup_delay() if (!enabled) { return 0; } + + // We use larger timeout to cleanup the HLS, after disposed it if required. return _srs_config->get_dash_dispose(req->vhost) * 1.1; } diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 233310bd0a..5c261d18d7 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -1281,6 +1281,8 @@ srs_utime_t SrsHls::cleanup_delay() if (!enabled) { return 0; } + + // We use larger timeout to cleanup the HLS, after disposed it if required. return _srs_config->get_hls_dispose(req->vhost) * 1.1; } diff --git a/trunk/src/app/srs_app_http_stream.cpp b/trunk/src/app/srs_app_http_stream.cpp index fdac3b6928..03e8064c7f 100755 --- a/trunk/src/app/srs_app_http_stream.cpp +++ b/trunk/src/app/srs_app_http_stream.cpp @@ -953,19 +953,19 @@ SrsHttpStreamServer::~SrsHttpStreamServer() if (true) { std::map::iterator it; - for (it = tflvs.begin(); it != tflvs.end(); ++it) { + for (it = templateHandlers.begin(); it != templateHandlers.end(); ++it) { SrsLiveEntry* entry = it->second; srs_freep(entry); } - tflvs.clear(); + templateHandlers.clear(); } if (true) { std::map::iterator it; - for (it = sflvs.begin(); it != sflvs.end(); ++it) { + for (it = streamHandlers.begin(); it != streamHandlers.end(); ++it) { SrsLiveEntry* entry = it->second; srs_freep(entry); } - sflvs.clear(); + streamHandlers.clear(); } } @@ -991,12 +991,12 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsRequest* r) SrsLiveEntry* entry = NULL; // create stream from template when not found. - if (sflvs.find(sid) == sflvs.end()) { - if (tflvs.find(r->vhost) == tflvs.end()) { + if (streamHandlers.find(sid) == streamHandlers.end()) { + if (templateHandlers.find(r->vhost) == templateHandlers.end()) { return err; } - SrsLiveEntry* tmpl = tflvs[r->vhost]; + SrsLiveEntry* tmpl = templateHandlers[r->vhost]; std::string mount = tmpl->mount; @@ -1023,8 +1023,8 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsRequest* r) srs_freep(tmpl->req); tmpl->req = r->copy()->as_http(); - - sflvs[sid] = entry; + + streamHandlers[sid] = entry; // mount the http flv stream. // we must register the handler, then start the thread, @@ -1032,7 +1032,7 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsRequest* r) if ((err = mux.handle(mount, entry->stream)) != srs_success) { return srs_error_wrap(err, "http: mount flv stream for vhost=%s failed", sid.c_str()); } - + // start http stream cache thread if ((err = entry->cache->start()) != srs_success) { return srs_error_wrap(err, "http: start stream cache failed"); @@ -1040,7 +1040,7 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsRequest* r) srs_trace("http: mount flv stream for sid=%s, mount=%s", sid.c_str(), mount.c_str()); } else { // The entry exists, we reuse it and update the request of stream and cache. - entry = sflvs[sid]; + entry = streamHandlers[sid]; entry->stream->update_auth(r); entry->cache->update_auth(r); } @@ -1057,15 +1057,15 @@ void SrsHttpStreamServer::http_unmount(SrsRequest* r) { std::string sid = r->get_stream_url(); - std::map::iterator it = sflvs.find(sid); - if (it == sflvs.end()) { + std::map::iterator it = streamHandlers.find(sid); + if (it == streamHandlers.end()) { return; } // Free all HTTP resources. SrsLiveEntry* entry = it->second; SrsAutoFree(SrsLiveEntry, entry); - sflvs.erase(it); + streamHandlers.erase(it); SrsLiveStream* stream = entry->stream; SrsAutoFree(SrsLiveStream, stream); @@ -1118,8 +1118,8 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle SrsLiveEntry* entry = NULL; if (true) { // no http streaming on vhost, ignore. - std::map::iterator it = tflvs.find(vhost->arg0()); - if (it == tflvs.end()) { + std::map::iterator it = templateHandlers.find(vhost->arg0()); + if (it == templateHandlers.end()) { return err; } @@ -1175,8 +1175,8 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle std::string sid = r->get_stream_url(); // check whether the http remux is enabled, // for example, user disable the http flv then reload. - if (sflvs.find(sid) != sflvs.end()) { - SrsLiveEntry* s_entry = sflvs[sid]; + if (streamHandlers.find(sid) != streamHandlers.end()) { + SrsLiveEntry* s_entry = streamHandlers[sid]; if (!s_entry->stream->entry->enabled) { // only when the http entry is disabled, check the config whether http flv disable, // for the http flv edge use hijack to trigger the edge ingester, we always mount it @@ -1205,8 +1205,8 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle // use the handler if exists. if (ph) { - if (sflvs.find(sid) != sflvs.end()) { - entry = sflvs[sid]; + if (streamHandlers.find(sid) != streamHandlers.end()) { + entry = streamHandlers[sid]; *ph = entry->stream; } } @@ -1249,8 +1249,8 @@ srs_error_t SrsHttpStreamServer::initialize_flv_entry(std::string vhost) } SrsLiveEntry* entry = new SrsLiveEntry(_srs_config->get_vhost_http_remux_mount(vhost)); - - tflvs[vhost] = entry; + + templateHandlers[vhost] = entry; srs_trace("http flv live stream, vhost=%s, mount=%s", vhost.c_str(), entry->mount.c_str()); return err; diff --git a/trunk/src/app/srs_app_http_stream.hpp b/trunk/src/app/srs_app_http_stream.hpp index c18e67562f..272c3b1bda 100755 --- a/trunk/src/app/srs_app_http_stream.hpp +++ b/trunk/src/app/srs_app_http_stream.hpp @@ -234,9 +234,9 @@ class SrsHttpStreamServer : public ISrsReloadHandler public: SrsHttpServeMux mux; // The http live streaming template, to create streams. - std::map tflvs; - // The http live streaming streams, crote by template. - std::map sflvs; + std::map templateHandlers; + // The http live streaming streams, created by template. + std::map streamHandlers; public: SrsHttpStreamServer(SrsServer* svr); virtual ~SrsHttpStreamServer();