mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
HLS: Stat the HLS streaming clients bandwidth. v5.0.49
This commit is contained in:
parent
c1df280211
commit
d7c2d5ab01
9 changed files with 98 additions and 18 deletions
|
@ -382,6 +382,8 @@ srs_error_t SrsHttpFileServer::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMes
|
|||
return serve_mp4_file(w, r, fullpath);
|
||||
} else if (srs_string_ends_with(upath, ".m3u8")) {
|
||||
return serve_m3u8_file(w, r, fullpath);
|
||||
} else if (srs_string_ends_with(upath, ".ts")) {
|
||||
return serve_ts_file(w, r, fullpath);
|
||||
}
|
||||
|
||||
// serve common static file.
|
||||
|
@ -531,6 +533,11 @@ srs_error_t SrsHttpFileServer::serve_m3u8_file(ISrsHttpResponseWriter * w, ISrsH
|
|||
return serve_m3u8_ctx(w, r, fullpath);
|
||||
}
|
||||
|
||||
srs_error_t SrsHttpFileServer::serve_ts_file(ISrsHttpResponseWriter * w, ISrsHttpMessage * r, std::string fullpath)
|
||||
{
|
||||
return serve_ts_ctx(w, r, fullpath);
|
||||
}
|
||||
|
||||
srs_error_t SrsHttpFileServer::serve_flv_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, string fullpath, int64_t offset)
|
||||
{
|
||||
// @remark For common http file server, we don't support stream request, please use SrsVodStream instead.
|
||||
|
@ -548,7 +555,12 @@ srs_error_t SrsHttpFileServer::serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsH
|
|||
srs_error_t SrsHttpFileServer::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMessage * r, std::string fullpath)
|
||||
{
|
||||
// @remark For common http file server, we don't support stream request, please use SrsVodStream instead.
|
||||
// TODO: FIXME: Support range in header https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Range_requests
|
||||
return serve_file(w, r, fullpath);
|
||||
}
|
||||
|
||||
srs_error_t SrsHttpFileServer::serve_ts_ctx(ISrsHttpResponseWriter * w, ISrsHttpMessage * r, std::string fullpath)
|
||||
{
|
||||
// @remark For common http file server, we don't support stream request, please use SrsVodStream instead.
|
||||
return serve_file(w, r, fullpath);
|
||||
}
|
||||
|
||||
|
|
|
@ -286,6 +286,7 @@ private:
|
|||
virtual srs_error_t serve_flv_file(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
virtual srs_error_t serve_mp4_file(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
virtual srs_error_t serve_m3u8_file(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
virtual srs_error_t serve_ts_file(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
protected:
|
||||
// When access flv file with x.flv?start=xxx
|
||||
virtual srs_error_t serve_flv_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath, int64_t offset);
|
||||
|
@ -304,6 +305,7 @@ protected:
|
|||
// Remark 2:
|
||||
// If use two same "hls_ctx" in different requests, SRS cannot detect so that they will be treated as one.
|
||||
virtual srs_error_t serve_m3u8_ctx(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
virtual srs_error_t serve_ts_ctx(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
|
||||
protected:
|
||||
// Copy the fs to response writer in size bytes.
|
||||
virtual srs_error_t copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, ISrsHttpMessage* r, int64_t size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue