mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix bug of get hls enabled config
This commit is contained in:
parent
3ad692bf97
commit
b3ef28f831
3 changed files with 14 additions and 10 deletions
|
@ -23,7 +23,7 @@ vhost __defaultVhost__ {
|
||||||
gop_cache on;
|
gop_cache on;
|
||||||
forward 127.0.0.1:19350;
|
forward 127.0.0.1:19350;
|
||||||
hls {
|
hls {
|
||||||
hls on;
|
enabled on;
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
|
@ -85,7 +85,7 @@ vhost dev {
|
||||||
gop_cache on;
|
gop_cache on;
|
||||||
#forward 127.0.0.1:19350;
|
#forward 127.0.0.1:19350;
|
||||||
hls {
|
hls {
|
||||||
hls off;
|
enabled on;
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
|
@ -635,7 +635,7 @@ vhost with-hls.vhost.com {
|
||||||
# whether the hls is enabled.
|
# whether the hls is enabled.
|
||||||
# if off, donot write hls(ts and m3u8) when publish.
|
# if off, donot write hls(ts and m3u8) when publish.
|
||||||
# default: off
|
# default: off
|
||||||
hls on;
|
enabled on;
|
||||||
# the hls output path.
|
# the hls output path.
|
||||||
# the app dir is auto created under the hls_path.
|
# the app dir is auto created under the hls_path.
|
||||||
# for example, for rtmp stream:
|
# for example, for rtmp stream:
|
||||||
|
@ -662,7 +662,7 @@ vhost no-hls.vhost.com {
|
||||||
# whether the hls is enabled.
|
# whether the hls is enabled.
|
||||||
# if off, donot write hls(ts and m3u8) when publish.
|
# if off, donot write hls(ts and m3u8) when publish.
|
||||||
# default: off
|
# default: off
|
||||||
hls off;
|
enabled off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# the vhost for min delay, donot cache any stream.
|
# the vhost for min delay, donot cache any stream.
|
||||||
|
|
|
@ -1312,13 +1312,19 @@ bool SrsConfig::get_hls_enabled(string vhost)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hls->arg0() == "off") {
|
SrsConfDirective* conf = hls->get("enabled");
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conf->arg0() == "on") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
string SrsConfig::get_hls_path(string vhost)
|
string SrsConfig::get_hls_path(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* hls = get_hls(vhost);
|
SrsConfDirective* hls = get_hls(vhost);
|
||||||
|
|
|
@ -1148,7 +1148,6 @@ int SrsHls::on_publish(SrsRequest* req)
|
||||||
std::string stream = req->stream;
|
std::string stream = req->stream;
|
||||||
std::string app = req->app;
|
std::string app = req->app;
|
||||||
|
|
||||||
// TODO: support reload.
|
|
||||||
if (!config->get_hls_enabled(vhost)) {
|
if (!config->get_hls_enabled(vhost)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1155,6 @@ int SrsHls::on_publish(SrsRequest* req)
|
||||||
// if enabled, open the muxer.
|
// if enabled, open the muxer.
|
||||||
hls_enabled = true;
|
hls_enabled = true;
|
||||||
|
|
||||||
// TODO: subscribe the reload event.
|
|
||||||
int hls_fragment = config->get_hls_fragment(vhost);
|
int hls_fragment = config->get_hls_fragment(vhost);
|
||||||
int hls_window = config->get_hls_window(vhost);
|
int hls_window = config->get_hls_window(vhost);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue