1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For RTC publisher, support black-hole

This commit is contained in:
winlin 2020-04-27 09:35:50 +08:00
parent e4329fd1a0
commit 7692e589ed
5 changed files with 146 additions and 17 deletions

View file

@ -3645,7 +3645,7 @@ srs_error_t SrsConfig::check_normal_config()
string n = conf->at(i)->name;
if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa"
&& n != "sendmmsg" && n != "encrypt" && n != "reuseport" && n != "gso" && n != "merge_nalus"
&& n != "padding" && n != "perf_stat" && n != "queue_length") {
&& n != "padding" && n != "perf_stat" && n != "queue_length" && n != "black_hole") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal rtc_server.%s", n.c_str());
}
}
@ -4742,7 +4742,7 @@ std::string SrsConfig::get_rtc_server_candidates()
return DEFAULT;
}
return (conf->arg0().c_str());
return conf->arg0();
}
bool SrsConfig::get_rtc_server_ecdsa()
@ -4943,6 +4943,50 @@ int SrsConfig::get_rtc_server_queue_length()
return ::atoi(conf->arg0().c_str());
}
bool SrsConfig::get_rtc_server_black_hole()
{
static bool DEFAULT = false;
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("black_hole");
if (!conf) {
return DEFAULT;
}
conf = conf->get("enabled");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
std::string SrsConfig::get_rtc_server_black_hole_publisher()
{
static string DEFAULT = "";
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("black_hole");
if (!conf) {
return DEFAULT;
}
conf = conf->get("publisher");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return conf->arg0();
}
SrsConfDirective* SrsConfig::get_rtc(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);