mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Support config the mw_sleep and mw_msgs
This commit is contained in:
parent
b0566d51ef
commit
08312ddc42
10 changed files with 132 additions and 71 deletions
|
@ -3785,7 +3785,8 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||
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") {
|
||||
&& m != "gop_cache" && m != "queue_length" && m != "send_min_interval" && m != "reduce_sequence_header"
|
||||
&& m != "mw_msgs") {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal vhost.play.%s of %s", m.c_str(), vhost->arg0().c_str());
|
||||
}
|
||||
}
|
||||
|
@ -5423,6 +5424,40 @@ srs_utime_t SrsConfig::get_mw_sleep(string vhost, bool is_rtc)
|
|||
return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS);
|
||||
}
|
||||
|
||||
int SrsConfig::get_mw_msgs(string vhost, bool is_realtime, bool is_rtc)
|
||||
{
|
||||
int DEFAULT = SRS_PERF_MW_MIN_MSGS;
|
||||
if (is_rtc) {
|
||||
DEFAULT = SRS_PERF_MW_MIN_MSGS_FOR_RTC;
|
||||
}
|
||||
if (is_realtime) {
|
||||
DEFAULT = SRS_PERF_MW_MIN_MSGS_REALTIME;
|
||||
}
|
||||
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
conf = conf->get("play");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
conf = conf->get("mw_msgs");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
int v = ::atoi(conf->arg0().c_str());
|
||||
if (v > SRS_PERF_MW_MSGS) {
|
||||
srs_warn("reset mw_msgs %d to max %d", v, SRS_PERF_MW_MSGS);
|
||||
v = SRS_PERF_MW_MSGS;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
bool SrsConfig::get_realtime_enabled(string vhost, bool is_rtc)
|
||||
{
|
||||
static bool SYS_DEFAULT = SRS_PERF_MIN_LATENCY_ENABLED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue