mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Config: Error when both HLS and HTTP-TS enabled. (#3400)
Co-authored-by: winlin <winlin@vip.126.com> Co-authored-by: john <hondaxiao@tencent.com>
This commit is contained in:
parent
2b0e32aace
commit
5b001fe344
4 changed files with 57 additions and 2 deletions
|
@ -2674,6 +2674,59 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check HLS with HTTP-TS
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
for (int n = 0; n < (int)vhosts.size(); n++) {
|
||||
SrsConfDirective* vhost = vhosts[n];
|
||||
|
||||
bool hls_enabled = false;
|
||||
bool http_remux_ts = false;
|
||||
int http_remux_cnt = 0;
|
||||
|
||||
for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) {
|
||||
SrsConfDirective* conf = vhost->at(i);
|
||||
string n = conf->name;
|
||||
if (n == "http_remux") {
|
||||
bool http_remux_enabled = false;
|
||||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||
string m = conf->at(j)->name;
|
||||
|
||||
// http_remux enabled
|
||||
if (m == "enabled" && conf->at(j)->arg0() == "on") {
|
||||
http_remux_enabled = true;
|
||||
}
|
||||
|
||||
// check mount suffix '.ts'
|
||||
if (http_remux_enabled && m == "mount" && srs_string_ends_with(conf->at(j)->arg0(), ".ts")) {
|
||||
http_remux_ts = true;
|
||||
}
|
||||
}
|
||||
http_remux_cnt++;
|
||||
} else if (n == "hls") {
|
||||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||
string m = conf->at(j)->name;
|
||||
|
||||
// hls enabled
|
||||
if (m == "enabled" && conf->at(j)->arg0() == "on") {
|
||||
hls_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check valid http-remux count
|
||||
if (http_remux_cnt > 1) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.http_remux only one but count=%d of %s", http_remux_cnt, vhost->arg0().c_str());
|
||||
}
|
||||
|
||||
// check hls conflict with http-ts
|
||||
if (hls_enabled && http_remux_ts) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "vhost.hls conflict with vhost.http-ts of %s", vhost->arg0().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// check ingest id unique.
|
||||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||
SrsConfDirective* vhost = vhosts[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue