mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #340, refine ts prefix code.
This commit is contained in:
parent
10da182853
commit
5969f72354
5 changed files with 22 additions and 5 deletions
|
@ -526,6 +526,13 @@ vhost with-hls.srs.com {
|
|||
# in a word, the hls_path is for vhost.
|
||||
# default: ./objs/nginx/html
|
||||
hls_path ./objs/nginx/html;
|
||||
# the hls entry prefix, which is base url of ts url.
|
||||
# if specified, the ts path in m3u8 will be like:
|
||||
# http://your-server/live/livestream-0.ts
|
||||
# http://your-server/live/livestream-1.ts
|
||||
# ...
|
||||
# optional, default to empty string.
|
||||
hls_entry_prefix http://your-server/;
|
||||
# the hls mount for hls_storage ram,
|
||||
# which use srs embeded http server to delivery HLS,
|
||||
# where the mount specifies the HTTP url to mount.
|
||||
|
|
|
@ -3152,7 +3152,17 @@ string SrsConfig::get_hls_entry_prefix(string vhost)
|
|||
return "";
|
||||
}
|
||||
|
||||
return conf->arg0();
|
||||
std::string hls_entry_prefix = conf->arg0();
|
||||
if (hls_entry_prefix.empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
char last_char = hls_entry_prefix[hls_entry_prefix.length() - 1];
|
||||
if (last_char != '/') {
|
||||
hls_entry_prefix.append("/");
|
||||
}
|
||||
|
||||
return hls_entry_prefix;
|
||||
}
|
||||
|
||||
string SrsConfig::get_hls_path(string vhost)
|
||||
|
|
|
@ -203,14 +203,14 @@ int SrsHlsMuxer::sequence_no()
|
|||
return _sequence_no;
|
||||
}
|
||||
|
||||
int SrsHlsMuxer::update_config(SrsRequest* r, string _entry_prefix, string path, int fragment, int window)
|
||||
int SrsHlsMuxer::update_config(SrsRequest* r, string hls_entry_prefix, string path, int fragment, int window)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_freep(req);
|
||||
req = r->copy();
|
||||
|
||||
entry_prefix = _entry_prefix;
|
||||
entry_prefix = hls_entry_prefix;
|
||||
hls_path = path;
|
||||
hls_fragment = fragment;
|
||||
hls_window = window;
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
/**
|
||||
* when publish, update the config for muxer.
|
||||
*/
|
||||
virtual int update_config(SrsRequest* r, std::string _entry_prefix, std::string path, int fragment, int window);
|
||||
virtual int update_config(SrsRequest* r, std::string hls_entry_prefix, std::string path, int fragment, int window);
|
||||
/**
|
||||
* open a new segment(a new ts file),
|
||||
* @param segment_start_dts use to calc the segment duration,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue