Merge branch '4.0release' into merge/develop

pull/2943/head
winlin 3 years ago
commit f7b86a5b8d

@ -36,6 +36,7 @@ using namespace std;
#include <srs_service_utility.hpp>
#include <srs_app_http_hooks.hpp>
#include <srs_app_statistic.hpp>
#include <srs_app_hybrid.hpp>
#define SRS_CONTEXT_IN_HLS "hls_ctx"
@ -53,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;
@ -183,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);
@ -195,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);
@ -244,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)) {
@ -295,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;
}
@ -325,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;
@ -347,9 +348,9 @@ srs_error_t SrsVodStream::on_timer(srs_utime_t interval)
break;
}
}
return err;
}
return err;
}
SrsHttpStaticServer::SrsHttpStaticServer(SrsServer* svr)

Loading…
Cancel
Save