From 79d73bafcfe59eda23104c98f1dead4d5bffdb7f Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 23 Sep 2021 22:04:14 +0800 Subject: [PATCH] Refine code space --- trunk/src/app/srs_app_http_static.cpp | 84 +++++++++++++-------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/trunk/src/app/srs_app_http_static.cpp b/trunk/src/app/srs_app_http_static.cpp index 5367316ab..8b5111fa1 100644 --- a/trunk/src/app/srs_app_http_static.cpp +++ b/trunk/src/app/srs_app_http_static.cpp @@ -54,7 +54,7 @@ SrsVodStream::~SrsVodStream() } map_ctx_info_.clear(); } - + srs_error_t SrsVodStream::serve_flv_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, string fullpath, int offset) { srs_error_t err = srs_success; @@ -184,10 +184,10 @@ srs_error_t SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsHttpMe } return err; -} - -srs_error_t SrsVodStream::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMessage * r, std::string fullpath) -{ +} + +srs_error_t SrsVodStream::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMessage * r, std::string fullpath) +{ srs_error_t err = srs_success; SrsHttpMessage* hr = dynamic_cast(r); @@ -196,7 +196,7 @@ srs_error_t SrsVodStream::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMes SrsRequest* req = hr->to_request(hr->host())->as_http(); SrsAutoFree(SrsRequest, req); - string ctx = hr->query_get(SRS_CONTEXT_IN_HLS); + string ctx = hr->query_get(SRS_CONTEXT_IN_HLS); if (!ctx.empty() && ctx_is_exist(ctx)) { alive(ctx, NULL); return SrsHttpFileServer::serve_m3u8_ctx(w, r, fullpath); @@ -245,29 +245,29 @@ srs_error_t SrsVodStream::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMes return srs_error_wrap(err, "stat on client"); } - return err; -} - -bool SrsVodStream::ctx_is_exist(std::string ctx) -{ - return (map_ctx_info_.find(ctx) != map_ctx_info_.end()); -} - -void SrsVodStream::alive(std::string ctx, SrsRequest* req) -{ - std::map::iterator it; + return err; +} + +bool SrsVodStream::ctx_is_exist(std::string ctx) +{ + return (map_ctx_info_.find(ctx) != map_ctx_info_.end()); +} + +void SrsVodStream::alive(std::string ctx, SrsRequest* req) +{ + std::map::iterator it; if ((it = map_ctx_info_.find(ctx)) != map_ctx_info_.end()) { it->second.request_time = srs_get_system_time(); - } else { - SrsM3u8CtxInfo info; - info.req = req; - info.request_time = srs_get_system_time(); - map_ctx_info_.insert(make_pair(ctx, info)); - } + } else { + SrsM3u8CtxInfo info; + info.req = req; + info.request_time = srs_get_system_time(); + map_ctx_info_.insert(make_pair(ctx, info)); + } } - -srs_error_t SrsVodStream::http_hooks_on_play(SrsRequest* req) -{ + +srs_error_t SrsVodStream::http_hooks_on_play(SrsRequest* req) +{ srs_error_t err = srs_success; if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) { @@ -296,11 +296,11 @@ srs_error_t SrsVodStream::http_hooks_on_play(SrsRequest* req) } } - return err; -} - -void SrsVodStream::http_hooks_on_stop(SrsRequest* req) -{ + return err; +} + +void SrsVodStream::http_hooks_on_stop(SrsRequest* req) +{ if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) { return; } @@ -326,14 +326,14 @@ void SrsVodStream::http_hooks_on_stop(SrsRequest* req) SrsHttpHooks::on_stop(url, req); } - return; -} - -srs_error_t SrsVodStream::on_timer(srs_utime_t interval) -{ - srs_error_t err = srs_success; - - std::map::iterator it; + return; +} + +srs_error_t SrsVodStream::on_timer(srs_utime_t interval) +{ + srs_error_t err = srs_success; + + std::map::iterator it; for (it = map_ctx_info_.begin(); it != map_ctx_info_.end(); ++it) { string ctx = it->first; SrsRequest* req = it->second.req; @@ -348,9 +348,9 @@ srs_error_t SrsVodStream::on_timer(srs_utime_t interval) break; } - } - - return err; + } + + return err; } SrsHttpStaticServer::SrsHttpStaticServer(SrsServer* svr)