mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #241, add mw(merged-write) config. 2.0.53
This commit is contained in:
parent
72fa33d9fb
commit
b1d7fbe668
12 changed files with 125 additions and 28 deletions
|
@ -45,6 +45,7 @@ using namespace std;
|
|||
#include <srs_app_source.hpp>
|
||||
#include <srs_kernel_file.hpp>
|
||||
#include <srs_app_utility.hpp>
|
||||
#include <srs_core_performance.hpp>
|
||||
|
||||
using namespace _srs_internal;
|
||||
|
||||
|
@ -829,6 +830,17 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
}
|
||||
srs_trace("vhost %s reload mr success.", vhost.c_str());
|
||||
}
|
||||
// mw, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("mw_latency"), old_vhost->get("mw_latency"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_mw(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes mw failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload mw success.", vhost.c_str());
|
||||
}
|
||||
// http, only one per vhost.
|
||||
if (!srs_directive_equals(new_vhost->get("http"), old_vhost->get("http"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1327,7 +1339,7 @@ int SrsConfig::check_config()
|
|||
&& n != "time_jitter"
|
||||
&& n != "atc" && n != "atc_auto"
|
||||
&& n != "debug_srs_upnode"
|
||||
&& n != "mr"
|
||||
&& n != "mr" && n != "mw_latency"
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
|
||||
|
@ -1951,7 +1963,7 @@ bool SrsConfig::get_gop_cache(string vhost)
|
|||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return true;
|
||||
return SRS_PERF_GOP_CACHE;
|
||||
}
|
||||
|
||||
conf = conf->get("gop_cache");
|
||||
|
@ -1959,7 +1971,7 @@ bool SrsConfig::get_gop_cache(string vhost)
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return SRS_PERF_GOP_CACHE;
|
||||
}
|
||||
|
||||
bool SrsConfig::get_debug_srs_upnode(string vhost)
|
||||
|
@ -2032,12 +2044,12 @@ double SrsConfig::get_queue_length(string vhost)
|
|||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return SRS_CONF_DEFAULT_QUEUE_LENGTH;
|
||||
return SRS_PERF_PLAY_QUEUE;
|
||||
}
|
||||
|
||||
conf = conf->get("queue_length");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_CONF_DEFAULT_QUEUE_LENGTH;
|
||||
return SRS_PERF_PLAY_QUEUE;
|
||||
}
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
|
@ -2106,17 +2118,17 @@ bool SrsConfig::get_mr_enabled(string vhost)
|
|||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return SRS_CONSTS_RTMP_MR;
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
}
|
||||
|
||||
conf = conf->get("mr");
|
||||
if (!conf) {
|
||||
return SRS_CONSTS_RTMP_MR;
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
}
|
||||
|
||||
conf = conf->get("enabled");
|
||||
if (!conf || conf->arg0() != "on") {
|
||||
return SRS_CONSTS_RTMP_MR;
|
||||
return SRS_PERF_MR_ENABLED;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2128,17 +2140,34 @@ int SrsConfig::get_mr_sleep_ms(string vhost)
|
|||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return SRS_CONSTS_RTMP_MR_SLEEP;
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
conf = conf->get("mr");
|
||||
if (!conf) {
|
||||
return SRS_CONSTS_RTMP_MR_SLEEP;
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
conf = conf->get("latency");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return SRS_CONSTS_RTMP_MR_SLEEP;
|
||||
return SRS_PERF_MR_SLEEP;
|
||||
}
|
||||
|
||||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
int SrsConfig::get_mw_sleep_ms(string vhost)
|
||||
{
|
||||
|
||||
SrsConfDirective* conf = get_vhost(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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue