mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine code space
This commit is contained in:
parent
c8d3542979
commit
79d73bafcf
1 changed files with 42 additions and 42 deletions
|
@ -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<SrsHttpMessage*>(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<std::string, SrsM3u8CtxInfo>::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<std::string, SrsM3u8CtxInfo>::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<std::string, SrsM3u8CtxInfo>::iterator it;
|
||||
return;
|
||||
}
|
||||
|
||||
srs_error_t SrsVodStream::on_timer(srs_utime_t interval)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
std::map<std::string, SrsM3u8CtxInfo>::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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue