mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #299, refine code.
This commit is contained in:
parent
62b7204514
commit
f32aab3d92
175 changed files with 15529 additions and 15935 deletions
|
@ -1,25 +1,25 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 SRS(ossrs)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2017 SRS(ossrs)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <srs_app_config.hpp>
|
||||
|
||||
|
@ -156,8 +156,8 @@ namespace _srs_internal
|
|||
// read total content from file.
|
||||
ssize_t nread = 0;
|
||||
if ((ret = reader.read(start, filesize, &nread)) != ERROR_SUCCESS) {
|
||||
srs_error("read file read error. expect %d, actual %d bytes, ret=%d",
|
||||
filesize, nread, ret);
|
||||
srs_error("read file read error. expect %d, actual %d bytes, ret=%d",
|
||||
filesize, nread, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ int srs_config_transform_vhost(SrsConfDirective* root)
|
|||
if (n == "time_jitter" || n == "mix_correct" || n == "atc" || n == "atc_auto"
|
||||
|| n == "mw_latency" || n == "gop_cache" || n == "queue_length" || n == "send_min_interval"
|
||||
|| n == "reduce_sequence_header"
|
||||
) {
|
||||
) {
|
||||
it = dir->directives.erase(it);
|
||||
|
||||
SrsConfDirective* play = dir->get_or_create("play");
|
||||
|
@ -925,13 +925,13 @@ int SrsConfDirective::parse_conf(SrsConfigBuffer* buffer, SrsDirectiveType type)
|
|||
ret = read_token(buffer, args, line_start);
|
||||
|
||||
/**
|
||||
* ret maybe:
|
||||
* ERROR_SYSTEM_CONFIG_INVALID error.
|
||||
* ERROR_SYSTEM_CONFIG_DIRECTIVE directive terminated by ';' found
|
||||
* ERROR_SYSTEM_CONFIG_BLOCK_START token terminated by '{' found
|
||||
* ERROR_SYSTEM_CONFIG_BLOCK_END the '}' found
|
||||
* ERROR_SYSTEM_CONFIG_EOF the config file is done
|
||||
*/
|
||||
* ret maybe:
|
||||
* ERROR_SYSTEM_CONFIG_INVALID error.
|
||||
* ERROR_SYSTEM_CONFIG_DIRECTIVE directive terminated by ';' found
|
||||
* ERROR_SYSTEM_CONFIG_BLOCK_START token terminated by '{' found
|
||||
* ERROR_SYSTEM_CONFIG_BLOCK_END the '}' found
|
||||
* ERROR_SYSTEM_CONFIG_EOF the config file is done
|
||||
*/
|
||||
if (ret == ERROR_SYSTEM_CONFIG_INVALID) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ int SrsConfDirective::parse_conf(SrsConfigBuffer* buffer, SrsDirectiveType type)
|
|||
|
||||
// build directive tree.
|
||||
SrsConfDirective* directive = new SrsConfDirective();
|
||||
|
||||
|
||||
directive->conf_line = line_start;
|
||||
directive->name = args[0];
|
||||
args.erase(args.begin());
|
||||
|
@ -980,9 +980,9 @@ int SrsConfDirective::parse_conf(SrsConfigBuffer* buffer, SrsDirectiveType type)
|
|||
int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args, int& line_start)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
char* pstart = buffer->pos;
|
||||
|
||||
|
||||
bool sharp_comment = false;
|
||||
|
||||
bool d_quoted = false;
|
||||
|
@ -1028,7 +1028,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args,
|
|||
return ERROR_SYSTEM_CONFIG_BLOCK_START;
|
||||
}
|
||||
srs_error("line %d: unexpected '%c'", buffer->line, ch);
|
||||
return ERROR_SYSTEM_CONFIG_INVALID;
|
||||
return ERROR_SYSTEM_CONFIG_INVALID;
|
||||
}
|
||||
|
||||
// last charecter is space.
|
||||
|
@ -1190,9 +1190,9 @@ void SrsConfig::unsubscribe(ISrsReloadHandler* handler)
|
|||
int SrsConfig::reload()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
SrsConfig conf;
|
||||
|
||||
|
||||
if ((ret = conf.parse_file(config_file.c_str())) != ERROR_SUCCESS) {
|
||||
srs_error("ignore config reloader parse file failed. ret=%d", ret);
|
||||
ret = ERROR_SUCCESS;
|
||||
|
@ -1205,7 +1205,7 @@ int SrsConfig::reload()
|
|||
srs_error("transform config failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
if ((ret = conf.check_config()) != ERROR_SUCCESS) {
|
||||
srs_error("ignore config reloader check config failed. ret=%d", ret);
|
||||
ret = ERROR_SUCCESS;
|
||||
|
@ -1230,7 +1230,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
// DISABLED => ENABLED
|
||||
// ENABLED => DISABLED
|
||||
// ENABLED => ENABLED (modified)
|
||||
|
||||
|
||||
// collect all vhost names
|
||||
std::vector<std::string> vhosts;
|
||||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||
|
@ -1254,7 +1254,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
// process each vhost
|
||||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||
std::string vhost = vhosts.at(i);
|
||||
|
||||
|
||||
SrsConfDirective* old_vhost = old_root->get("vhost", vhost);
|
||||
SrsConfDirective* new_vhost = root->get("vhost", vhost);
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
|
||||
// the auto reload configs:
|
||||
// publish.parse_sps
|
||||
|
||||
|
||||
// ENABLED => ENABLED (modified)
|
||||
if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) {
|
||||
srs_trace("vhost %s maybe modified, reload its detail.", vhost.c_str());
|
||||
|
@ -1377,7 +1377,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
}
|
||||
srs_trace("vhost %s reload hls success.", vhost.c_str());
|
||||
}
|
||||
|
||||
|
||||
// hds reload
|
||||
if (!srs_directive_equals(new_vhost->get("hds"), old_vhost->get("hds"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1389,7 +1389,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
}
|
||||
srs_trace("vhost %s reload hds success.", vhost.c_str());
|
||||
}
|
||||
|
||||
|
||||
// dvr, only one per vhost, except the dvr_apply
|
||||
if (!srs_directive_equals(new_vhost->get("dvr"), old_vhost->get("dvr"), "dvr_apply")) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1473,9 +1473,9 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
continue;
|
||||
}
|
||||
srs_trace("ignore reload vhost, enabled old: %d, new: %d",
|
||||
get_vhost_enabled(old_vhost), get_vhost_enabled(new_vhost));
|
||||
get_vhost_enabled(old_vhost), get_vhost_enabled(new_vhost));
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1491,7 +1491,7 @@ int SrsConfig::reload_conf(SrsConfig* conf)
|
|||
|
||||
// merge config.
|
||||
std::vector<ISrsReloadHandler*>::iterator it;
|
||||
|
||||
|
||||
// never support reload:
|
||||
// daemon
|
||||
//
|
||||
|
@ -1499,7 +1499,7 @@ int SrsConfig::reload_conf(SrsConfig* conf)
|
|||
// chunk_size, ff_log_dir,
|
||||
// bandcheck, http_hooks, heartbeat,
|
||||
// security
|
||||
|
||||
|
||||
// merge config: listen
|
||||
if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
|
||||
if ((ret = do_reload_listen()) != ERROR_SUCCESS) {
|
||||
|
@ -1565,10 +1565,10 @@ int SrsConfig::reload_conf(SrsConfig* conf)
|
|||
if ((ret = reload_http_stream(old_root)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// TODO: FIXME: support reload stream_caster.
|
||||
// TODO: FIXME: support reload kafka.
|
||||
|
||||
|
||||
// merge config: vhost
|
||||
if ((ret = reload_vhost(old_root)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
|
@ -1592,7 +1592,7 @@ int SrsConfig::reload_http_api(SrsConfDirective* old_root)
|
|||
|
||||
SrsConfDirective* new_http_api = root->get("http_api");
|
||||
SrsConfDirective* old_http_api = old_root->get("http_api");
|
||||
|
||||
|
||||
// DISABLED => ENABLED
|
||||
if (!get_http_api_enabled(old_http_api) && get_http_api_enabled(new_http_api)) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1606,7 +1606,7 @@ int SrsConfig::reload_http_api(SrsConfDirective* old_root)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// ENABLED => DISABLED
|
||||
if (get_http_api_enabled(old_http_api) && !get_http_api_enabled(new_http_api)) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1624,7 +1624,7 @@ int SrsConfig::reload_http_api(SrsConfDirective* old_root)
|
|||
// ENABLED => ENABLED (modified)
|
||||
if (get_http_api_enabled(old_http_api) && get_http_api_enabled(new_http_api)
|
||||
&& !srs_directive_equals(old_http_api, new_http_api)
|
||||
) {
|
||||
) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_http_api_enabled()) != ERROR_SUCCESS) {
|
||||
|
@ -1679,7 +1679,7 @@ int SrsConfig::reload_http_stream(SrsConfDirective* old_root)
|
|||
|
||||
SrsConfDirective* new_http_stream = root->get("http_server");
|
||||
SrsConfDirective* old_http_stream = old_root->get("http_server");
|
||||
|
||||
|
||||
// DISABLED => ENABLED
|
||||
if (!get_http_stream_enabled(old_http_stream) && get_http_stream_enabled(new_http_stream)) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1693,7 +1693,7 @@ int SrsConfig::reload_http_stream(SrsConfDirective* old_root)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// ENABLED => DISABLED
|
||||
if (get_http_stream_enabled(old_http_stream) && !get_http_stream_enabled(new_http_stream)) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1711,7 +1711,7 @@ int SrsConfig::reload_http_stream(SrsConfDirective* old_root)
|
|||
// ENABLED => ENABLED (modified)
|
||||
if (get_http_stream_enabled(old_http_stream) && get_http_stream_enabled(new_http_stream)
|
||||
&& !srs_directive_equals(old_http_stream, new_http_stream)
|
||||
) {
|
||||
) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_http_stream_updated()) != ERROR_SUCCESS) {
|
||||
|
@ -1765,7 +1765,7 @@ int SrsConfig::reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* o
|
|||
std::string vhost = new_vhost->arg0();
|
||||
|
||||
// to be simple:
|
||||
// whatever, once tiny changed of transcode,
|
||||
// whatever, once tiny changed of transcode,
|
||||
// restart all ffmpeg of vhost.
|
||||
bool changed = false;
|
||||
|
||||
|
@ -1860,8 +1860,8 @@ int SrsConfig::reload_ingest(SrsConfDirective* new_vhost, SrsConfDirective* old_
|
|||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_ingest_removed(vhost, ingest_id)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes ingest=%s removed failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
srs_error("vhost %s notify subscribes ingest=%s removed failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -1880,15 +1880,15 @@ int SrsConfig::reload_ingest(SrsConfDirective* new_vhost, SrsConfDirective* old_
|
|||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_ingest_added(vhost, ingest_id)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes ingest=%s added failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
srs_error("vhost %s notify subscribes ingest=%s added failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload ingest=%s added success.", vhost.c_str(), ingest_id.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for updated ingesters, restart them.
|
||||
for (int i = 0; i < (int)new_ingesters.size(); i++) {
|
||||
SrsConfDirective* new_ingester = new_ingesters.at(i);
|
||||
|
@ -1900,20 +1900,20 @@ int SrsConfig::reload_ingest(SrsConfDirective* new_vhost, SrsConfDirective* old_
|
|||
if (srs_directive_equals(new_ingester, old_ingester)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// notice handler ingester removed.
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_ingest_updated(vhost, ingest_id)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes ingest=%s updated failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
srs_error("vhost %s notify subscribes ingest=%s updated failed. ret=%d",
|
||||
vhost.c_str(), ingest_id.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload ingest=%s updated success.", vhost.c_str(), ingest_id.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
srs_trace("ingest not changed for vhost=%s", vhost.c_str());
|
||||
|
||||
return ret;
|
||||
|
@ -1963,7 +1963,7 @@ int SrsConfig::parse_options(int argc, char** argv)
|
|||
srs_error("config file not specified, see help: %s -h, ret=%d", argv[0], ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = parse_file(config_file.c_str());
|
||||
|
||||
// transform config to compatible with previous style of config.
|
||||
|
@ -1978,7 +1978,7 @@ int SrsConfig::parse_options(int argc, char** argv)
|
|||
if (ret == ERROR_SUCCESS) {
|
||||
ret = check_config();
|
||||
}
|
||||
|
||||
|
||||
if (ret == ERROR_SUCCESS) {
|
||||
srs_trace("config file is ok");
|
||||
exit(0);
|
||||
|
@ -1987,7 +1987,7 @@ int SrsConfig::parse_options(int argc, char** argv)
|
|||
exit(ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check log name and level
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2013,12 +2013,12 @@ int SrsConfig::parse_options(int argc, char** argv)
|
|||
int SrsConfig::initialize_cwd()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
// cwd
|
||||
char cwd[256];
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
_cwd = cwd;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3410,7 +3410,7 @@ int SrsConfig::parse_argv(int& i, char** argv)
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
char* p = argv[i];
|
||||
|
||||
|
||||
if (*p++ != '-') {
|
||||
show_help = true;
|
||||
return ret;
|
||||
|
@ -3488,33 +3488,33 @@ int SrsConfig::parse_argv(int& i, char** argv)
|
|||
void SrsConfig::print_help(char** argv)
|
||||
{
|
||||
printf(
|
||||
RTMP_SIG_SRS_SERVER" "RTMP_SIG_SRS_COPYRIGHT"\n"
|
||||
"License: "RTMP_SIG_SRS_LICENSE"\n"
|
||||
"Primary: "RTMP_SIG_SRS_PRIMARY"\n"
|
||||
"Authors: "RTMP_SIG_SRS_AUTHROS"\n"
|
||||
"Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_USER_CONFIGURE"\n"
|
||||
"Features:"SRS_AUTO_CONFIGURE"\n""\n"
|
||||
"Usage: %s [-h?vVsS] [[-t] -c <filename>]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -?, -h : show this help and exit(0)\n"
|
||||
" -v, -V : show version and exit(0)\n"
|
||||
" -g, -G : show server signature and exit(0)\n"
|
||||
" -t : test configuration file, exit(error_code).\n"
|
||||
" -c filename : use configuration file for SRS\n"
|
||||
"For srs-dolphin:\n"
|
||||
" -p rtmp-port : the rtmp port to listen.\n"
|
||||
" -x http-port : the http port to listen.\n"
|
||||
"\n"
|
||||
RTMP_SIG_SRS_WEB"\n"
|
||||
RTMP_SIG_SRS_URL"\n"
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n"
|
||||
"\n"
|
||||
"For example:\n"
|
||||
" %s -v\n"
|
||||
" %s -t -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n"
|
||||
" %s -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n",
|
||||
argv[0], argv[0], argv[0], argv[0]);
|
||||
RTMP_SIG_SRS_SERVER" "RTMP_SIG_SRS_COPYRIGHT"\n"
|
||||
"License: "RTMP_SIG_SRS_LICENSE"\n"
|
||||
"Primary: "RTMP_SIG_SRS_PRIMARY"\n"
|
||||
"Authors: "RTMP_SIG_SRS_AUTHROS"\n"
|
||||
"Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_USER_CONFIGURE"\n"
|
||||
"Features:"SRS_AUTO_CONFIGURE"\n""\n"
|
||||
"Usage: %s [-h?vVsS] [[-t] -c <filename>]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -?, -h : show this help and exit(0)\n"
|
||||
" -v, -V : show version and exit(0)\n"
|
||||
" -g, -G : show server signature and exit(0)\n"
|
||||
" -t : test configuration file, exit(error_code).\n"
|
||||
" -c filename : use configuration file for SRS\n"
|
||||
"For srs-dolphin:\n"
|
||||
" -p rtmp-port : the rtmp port to listen.\n"
|
||||
" -x http-port : the http port to listen.\n"
|
||||
"\n"
|
||||
RTMP_SIG_SRS_WEB"\n"
|
||||
RTMP_SIG_SRS_URL"\n"
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n"
|
||||
"\n"
|
||||
"For example:\n"
|
||||
" %s -v\n"
|
||||
" %s -t -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n"
|
||||
" %s -c "SRS_CONF_DEFAULT_COFNIG_FILE"\n",
|
||||
argv[0], argv[0], argv[0], argv[0]);
|
||||
}
|
||||
|
||||
int SrsConfig::parse_file(const char* filename)
|
||||
|
@ -3539,9 +3539,9 @@ int SrsConfig::parse_file(const char* filename)
|
|||
int SrsConfig::check_config()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
srs_trace("srs checking config...");
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check empty
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3557,13 +3557,13 @@ int SrsConfig::check_config()
|
|||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||
SrsConfDirective* conf = root->at(i);
|
||||
std::string n = conf->name;
|
||||
if (n != "listen" && n != "pid" && n != "chunk_size" && n != "ff_log_dir"
|
||||
if (n != "listen" && n != "pid" && n != "chunk_size" && n != "ff_log_dir"
|
||||
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_file"
|
||||
&& n != "max_connections" && n != "daemon" && n != "heartbeat"
|
||||
&& n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print_ms"
|
||||
&& n != "http_server" && n != "stream_caster" && n != "kafka"
|
||||
&& n != "utc_time" && n != "work_dir" && n != "asprocess"
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported directive %s, ret=%d", n.c_str(), ret);
|
||||
return ret;
|
||||
|
@ -3638,7 +3638,7 @@ int SrsConfig::check_config()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check listen for rtmp.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3688,18 +3688,18 @@ int SrsConfig::check_config()
|
|||
|
||||
int max_open_files = (int)sysconf(_SC_OPEN_MAX);
|
||||
int nb_canbe = max_open_files - nb_consumed_fds - 1;
|
||||
|
||||
|
||||
// for each play connections, we open a pipe(2fds) to convert SrsConsumver to io,
|
||||
// refine performance, @see: https://github.com/ossrs/srs/issues/194
|
||||
if (nb_total >= max_open_files) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("invalid max_connections=%d, required=%d, system limit to %d, "
|
||||
"total=%d(max_connections=%d, nb_consumed_fds=%d), ret=%d. "
|
||||
"you can change max_connections from %d to %d, or "
|
||||
"you can login as root and set the limit: ulimit -HSn %d",
|
||||
nb_connections, nb_total + 100, max_open_files,
|
||||
nb_total, nb_connections, nb_consumed_fds,
|
||||
ret, nb_connections, nb_canbe, nb_total + 100);
|
||||
"total=%d(max_connections=%d, nb_consumed_fds=%d), ret=%d. "
|
||||
"you can change max_connections from %d to %d, or "
|
||||
"you can login as root and set the limit: ulimit -HSn %d",
|
||||
nb_connections, nb_total + 100, max_open_files,
|
||||
nb_total, nb_connections, nb_consumed_fds,
|
||||
ret, nb_connections, nb_canbe, nb_total + 100);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -3709,18 +3709,18 @@ int SrsConfig::check_config()
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
if (get_heartbeat_interval() <= 0) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive heartbeat interval invalid, interval=%"PRId64", ret=%d",
|
||||
get_heartbeat_interval(), ret);
|
||||
srs_error("directive heartbeat interval invalid, interval=%"PRId64", ret=%d",
|
||||
get_heartbeat_interval(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check stats
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if (get_stats_network() < 0) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive stats network invalid, network=%d, ret=%d",
|
||||
get_stats_network(), ret);
|
||||
srs_error("directive stats network invalid, network=%d, ret=%d",
|
||||
get_stats_network(), ret);
|
||||
return ret;
|
||||
}
|
||||
if (true) {
|
||||
|
@ -3729,7 +3729,7 @@ int SrsConfig::check_config()
|
|||
if (index >= (int)ips.size()) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("stats network invalid, total local ip count=%d, index=%d, ret=%d",
|
||||
(int)ips.size(), index, ret);
|
||||
(int)ips.size(), index, ret);
|
||||
return ret;
|
||||
}
|
||||
srs_warn("stats network use index=%d, ip=%s", index, ips.at(index).c_str());
|
||||
|
@ -3754,7 +3754,7 @@ int SrsConfig::check_config()
|
|||
if (get_http_api_listen().empty()) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive http_api listen invalid, listen=%s, ret=%d",
|
||||
get_http_api_listen().c_str(), ret);
|
||||
get_http_api_listen().c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3764,10 +3764,10 @@ int SrsConfig::check_config()
|
|||
if (get_http_stream_listen().empty()) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive http_stream listen invalid, listen=%s, ret=%d",
|
||||
get_http_stream_listen().c_str(), ret);
|
||||
get_http_stream_listen().c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check log name and level
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3805,7 +3805,7 @@ int SrsConfig::check_config()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check vhosts.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3823,7 +3823,7 @@ int SrsConfig::check_config()
|
|||
&& n != "security" && n != "http_remux" && n != "dash"
|
||||
&& n != "http_static" && n != "hds" && n != "exec"
|
||||
&& n != "in_ack_size" && n != "out_ack_size"
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
|
||||
return ret;
|
||||
|
@ -3834,7 +3834,7 @@ int SrsConfig::check_config()
|
|||
string m = conf->at(j)->name;
|
||||
if (m != "enabled" && m != "dvr_apply" && m != "dvr_path" && m != "dvr_plan"
|
||||
&& m != "dvr_duration" && m != "dvr_wait_keyframe" && m != "time_jitter"
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);
|
||||
return ret;
|
||||
|
@ -3863,7 +3863,7 @@ int SrsConfig::check_config()
|
|||
string m = conf->at(j)->name;
|
||||
if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto" && m != "mw_latency"
|
||||
&& m != "gop_cache" && m != "queue_length" && m != "send_min_interval" && m != "reduce_sequence_header"
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported vhost play directive %s, ret=%d", m.c_str(), ret);
|
||||
return ret;
|
||||
|
@ -4015,13 +4015,13 @@ int SrsConfig::check_config()
|
|||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||
SrsConfDirective* vhost = vhosts[i];
|
||||
std::vector<std::string> ids;
|
||||
|
||||
|
||||
for (int j = 0; j < (int)vhost->directives.size(); j++) {
|
||||
SrsConfDirective* conf = vhost->at(j);
|
||||
if (conf->name != "ingest") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
std::string id = conf->arg0();
|
||||
for (int k = 0; k < (int)ids.size(); k++) {
|
||||
if (id == ids.at(k)) {
|
||||
|
@ -4038,24 +4038,24 @@ int SrsConfig::check_config()
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// check chunk size
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if (get_global_chunk_size() < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
|
||||
if (get_global_chunk_size() < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
|
||||
|| get_global_chunk_size() > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d",
|
||||
get_global_chunk_size(), SRS_CONSTS_RTMP_MIN_CHUNK_SIZE,
|
||||
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, ret);
|
||||
srs_error("directive chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d",
|
||||
get_global_chunk_size(), SRS_CONSTS_RTMP_MIN_CHUNK_SIZE,
|
||||
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, ret);
|
||||
return ret;
|
||||
}
|
||||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||
SrsConfDirective* vhost = vhosts[i];
|
||||
if (get_chunk_size(vhost->arg0()) < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
|
||||
if (get_chunk_size(vhost->arg0()) < SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
|
||||
|| get_chunk_size(vhost->arg0()) > SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
|
||||
) {
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive vhost %s chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d",
|
||||
vhost->arg0().c_str(), get_chunk_size(vhost->arg0()), SRS_CONSTS_RTMP_MIN_CHUNK_SIZE,
|
||||
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, ret);
|
||||
srs_error("directive vhost %s chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d",
|
||||
vhost->arg0().c_str(), get_chunk_size(vhost->arg0()), SRS_CONSTS_RTMP_MIN_CHUNK_SIZE,
|
||||
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -4078,9 +4078,9 @@ int SrsConfig::check_config()
|
|||
for (int j = 0; j < (int)ingesters.size(); j++) {
|
||||
SrsConfDirective* ingest = ingesters[j];
|
||||
if (get_ingest_enabled(ingest)) {
|
||||
srs_warn("ingest %s of vhost %s is disabled by configure",
|
||||
ingest->arg0().c_str(), vhost->arg0().c_str()
|
||||
);
|
||||
srs_warn("ingest %s of vhost %s is disabled by configure",
|
||||
ingest->arg0().c_str(), vhost->arg0().c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -4121,7 +4121,7 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer)
|
|||
set_config_directive(root, "daemon", "off");
|
||||
set_config_directive(root, "srs_log_tank", "console");
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4222,7 +4222,7 @@ string SrsConfig::get_work_dir() {
|
|||
if( !conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
|
||||
return conf->arg0();
|
||||
|
@ -4282,12 +4282,12 @@ string SrsConfig::get_stream_caster_engine(SrsConfDirective* conf)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("caster");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
|
@ -4314,12 +4314,12 @@ int SrsConfig::get_stream_caster_listen(SrsConfDirective* conf)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("listen");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -4430,14 +4430,14 @@ SrsConfDirective* SrsConfig::get_vhost(string vhost, bool try_default_vhost)
|
|||
void SrsConfig::get_vhosts(vector<SrsConfDirective*>& vhosts)
|
||||
{
|
||||
srs_assert(root);
|
||||
|
||||
|
||||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||
SrsConfDirective* conf = root->at(i);
|
||||
|
||||
|
||||
if (!conf->is_vhost()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
vhosts.push_back(conf);
|
||||
}
|
||||
}
|
||||
|
@ -4738,14 +4738,14 @@ int SrsConfig::get_chunk_size(string vhost)
|
|||
// use the global instead.
|
||||
return get_global_chunk_size();
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("chunk_size");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
// vhost does not specify the chunk size,
|
||||
// use the global instead.
|
||||
return get_global_chunk_size();
|
||||
}
|
||||
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -4778,12 +4778,12 @@ bool SrsConfig::get_mr_enabled(string vhost)
|
|||
if (!conf) {
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("publish");
|
||||
if (!conf) {
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("mr");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
|
@ -4798,17 +4798,17 @@ int SrsConfig::get_mr_sleep_ms(string vhost)
|
|||
if (!conf) {
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("publish");
|
||||
if (!conf) {
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("mr_latency");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -4823,12 +4823,12 @@ int SrsConfig::get_mw_sleep_ms(string vhost)
|
|||
if (!conf) {
|
||||
return SRS_PERF_MW_SLEEP;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("mw_latency");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_PERF_MW_SLEEP;
|
||||
}
|
||||
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -4838,12 +4838,12 @@ bool SrsConfig::get_realtime_enabled(string vhost)
|
|||
if (!conf) {
|
||||
return SRS_PERF_MIN_LATENCY_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("min_latency");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_PERF_MIN_LATENCY_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
return SRS_CONF_PERFER_FALSE(conf->arg0());
|
||||
}
|
||||
|
||||
|
@ -5006,7 +5006,7 @@ SrsConfDirective* SrsConfig::get_forwards(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_http_hooks(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5016,9 +5016,9 @@ SrsConfDirective* SrsConfig::get_vhost_http_hooks(string vhost)
|
|||
bool SrsConfig::get_vhost_http_hooks_enabled(string vhost)
|
||||
{
|
||||
static bool DEFAULT = false;
|
||||
|
||||
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -5033,7 +5033,7 @@ bool SrsConfig::get_vhost_http_hooks_enabled(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5043,7 +5043,7 @@ SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5053,7 +5053,7 @@ SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5063,7 +5063,7 @@ SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5073,7 +5073,7 @@ SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5083,7 +5083,7 @@ SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
|
|||
SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
if (!conf) {
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5128,12 +5128,12 @@ bool SrsConfig::get_bw_check_enabled(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("bandcheck");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("enabled");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
|
@ -5150,7 +5150,7 @@ string SrsConfig::get_bw_check_key(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("bandcheck");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -5160,7 +5160,7 @@ string SrsConfig::get_bw_check_key(string vhost)
|
|||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
|
@ -5172,7 +5172,7 @@ int SrsConfig::get_bw_check_interval_ms(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("bandcheck");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -5182,7 +5182,7 @@ int SrsConfig::get_bw_check_interval_ms(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return (int)(::atof(conf->arg0().c_str()) * 1000);
|
||||
}
|
||||
|
||||
|
@ -5194,7 +5194,7 @@ int SrsConfig::get_bw_check_limit_kbps(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("bandcheck");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -5204,7 +5204,7 @@ int SrsConfig::get_bw_check_limit_kbps(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -5227,12 +5227,12 @@ bool SrsConfig::get_vhost_is_edge(SrsConfDirective* vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("mode");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return "remote" == conf->arg0();
|
||||
}
|
||||
|
||||
|
@ -5617,7 +5617,7 @@ string SrsConfig::get_engine_vpreset(SrsConfDirective* conf)
|
|||
vector<string> SrsConfig::get_engine_vparams(SrsConfDirective* conf)
|
||||
{
|
||||
vector<string> vparams;
|
||||
|
||||
|
||||
if (!conf) {
|
||||
return vparams;
|
||||
}
|
||||
|
@ -5882,7 +5882,7 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* conf)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("type");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
|
@ -5903,7 +5903,7 @@ string SrsConfig::get_ingest_input_url(SrsConfDirective* conf)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("url");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
|
@ -6111,7 +6111,7 @@ string SrsConfig::get_hls_entry_prefix(string vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
|
@ -6196,7 +6196,7 @@ double SrsConfig::get_hls_fragment(string vhost)
|
|||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return ::atof(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
|
@ -6265,7 +6265,7 @@ string SrsConfig::get_hls_on_error(string vhost)
|
|||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
|
@ -6374,11 +6374,11 @@ bool SrsConfig::get_hls_wait_keyframe(string vhost)
|
|||
SrsConfDirective *SrsConfig::get_hds(const string &vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return conf->get("hds");
|
||||
}
|
||||
|
||||
|
@ -6390,7 +6390,7 @@ bool SrsConfig::get_hds_enabled(const string &vhost)
|
|||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
conf = conf->get("enabled");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
|
@ -6615,7 +6615,7 @@ string SrsConfig::get_http_api_listen()
|
|||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue