mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor default config
This commit is contained in:
parent
b6a929f9cf
commit
39853160d1
2 changed files with 37 additions and 25 deletions
|
@ -4751,12 +4751,20 @@ int SrsConfig::get_rtc_server_sendmmsg()
|
|||
|
||||
int SrsConfig::get_rtc_server_reuseport()
|
||||
{
|
||||
#if defined(SO_REUSEPORT)
|
||||
static int DEFAULT = 4;
|
||||
#else
|
||||
static int DEFAULT = 1;
|
||||
int v = get_rtc_server_reuseport2();
|
||||
|
||||
#if !defined(SO_REUSEPORT)
|
||||
srs_warn("REUSEPORT not supported, reset %d to %d", reuseport, DEFAULT);
|
||||
v = 1
|
||||
#endif
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
int SrsConfig::get_rtc_server_reuseport2()
|
||||
{
|
||||
static int DEFAULT = 4;
|
||||
|
||||
SrsConfDirective* conf = root->get("rtc_server");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
|
@ -4767,13 +4775,7 @@ int SrsConfig::get_rtc_server_reuseport()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
int reuseport = ::atoi(conf->arg0().c_str());
|
||||
#if !defined(SO_REUSEPORT)
|
||||
srs_warn("REUSEPORT not supported, reset %d to %d", reuseport, DEFAULT);
|
||||
reuseport = DEFAULT
|
||||
#endif
|
||||
|
||||
return reuseport;
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
bool SrsConfig::get_rtc_server_merge_nalus()
|
||||
|
@ -4795,19 +4797,7 @@ bool SrsConfig::get_rtc_server_merge_nalus()
|
|||
|
||||
bool SrsConfig::get_rtc_server_gso()
|
||||
{
|
||||
static int DEFAULT = true;
|
||||
|
||||
SrsConfDirective* conf = root->get("rtc_server");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
conf = conf->get("gso");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
bool v = SRS_CONF_PERFER_TRUE(conf->arg0());
|
||||
bool v = get_rtc_server_gso2();
|
||||
|
||||
bool gso_disabled = false;
|
||||
#if !defined(__linux__)
|
||||
|
@ -4833,6 +4823,23 @@ bool SrsConfig::get_rtc_server_gso()
|
|||
return v;
|
||||
}
|
||||
|
||||
bool SrsConfig::get_rtc_server_gso2()
|
||||
{
|
||||
static int DEFAULT = true;
|
||||
|
||||
SrsConfDirective* conf = root->get("rtc_server");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
conf = conf->get("gso");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
return SRS_CONF_PERFER_TRUE(conf->arg0());
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_rtc(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
|
|
@ -528,9 +528,14 @@ public:
|
|||
virtual int get_rtc_server_sendmmsg();
|
||||
virtual bool get_rtc_server_encrypt();
|
||||
virtual int get_rtc_server_reuseport();
|
||||
private:
|
||||
virtual int get_rtc_server_reuseport2();
|
||||
public:
|
||||
virtual bool get_rtc_server_merge_nalus();
|
||||
virtual bool get_rtc_server_gso();
|
||||
|
||||
private:
|
||||
virtual bool get_rtc_server_gso2();
|
||||
public:
|
||||
SrsConfDirective* get_rtc(std::string vhost);
|
||||
bool get_rtc_enabled(std::string vhost);
|
||||
bool get_rtc_bframe_discard(std::string vhost);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue