mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #319, move smi and rsh to play
This commit is contained in:
parent
f7c893d907
commit
bc24c0407b
7 changed files with 43 additions and 63 deletions
|
@ -437,6 +437,21 @@ vhost play.srs.com {
|
||||||
# the value recomment is [300, 1800]
|
# the value recomment is [300, 1800]
|
||||||
# default: 350
|
# default: 350
|
||||||
mw_latency 350;
|
mw_latency 350;
|
||||||
|
|
||||||
|
# the minimal packets send interval in ms,
|
||||||
|
# used to control the ndiff of stream by srs_rtmp_dump,
|
||||||
|
# for example, some device can only accept some stream which
|
||||||
|
# delivery packets in constant interval(not cbr).
|
||||||
|
# @remark 0 to disable the minimal interval.
|
||||||
|
# @remark >0 to make the srs to send message one by one.
|
||||||
|
# @remark user can get the right packets interval in ms by srs_rtmp_dump.
|
||||||
|
# default: 0
|
||||||
|
send_min_interval 10.0;
|
||||||
|
# whether reduce the sequence header,
|
||||||
|
# for some client which cannot got duplicated sequence header,
|
||||||
|
# while the sequence header is not changed yet.
|
||||||
|
# default: off
|
||||||
|
reduce_sequence_header on;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,25 +516,12 @@ vhost stream.control.com {
|
||||||
# @see scope.vhost.srs.com
|
# @see scope.vhost.srs.com
|
||||||
tcp_nodelay on;
|
tcp_nodelay on;
|
||||||
|
|
||||||
# the minimal packets send interval in ms,
|
|
||||||
# used to control the ndiff of stream by srs_rtmp_dump,
|
|
||||||
# for example, some device can only accept some stream which
|
|
||||||
# delivery packets in constant interval(not cbr).
|
|
||||||
# @remark 0 to disable the minimal interval.
|
|
||||||
# @remark >0 to make the srs to send message one by one.
|
|
||||||
# @remark user can get the right packets interval in ms by srs_rtmp_dump.
|
|
||||||
# default: 0
|
|
||||||
send_min_interval 10.0;
|
|
||||||
# whether reduce the sequence header,
|
|
||||||
# for some client which cannot got duplicated sequence header,
|
|
||||||
# while the sequence header is not changed yet.
|
|
||||||
# default: off
|
|
||||||
reduce_sequence_header on;
|
|
||||||
|
|
||||||
# @see play.srs.com
|
# @see play.srs.com
|
||||||
play {
|
play {
|
||||||
mw_latency 100;
|
mw_latency 100;
|
||||||
queue_length 10;
|
queue_length 10;
|
||||||
|
send_min_interval 10.0;
|
||||||
|
reduce_sequence_header on;
|
||||||
}
|
}
|
||||||
|
|
||||||
# @see publish.srs.com
|
# @see publish.srs.com
|
||||||
|
|
|
@ -79,7 +79,6 @@ vhost vhost.srs.com {
|
||||||
gop_cache off;
|
gop_cache off;
|
||||||
queue_length 10;
|
queue_length 10;
|
||||||
|
|
||||||
# TODO
|
|
||||||
send_min_interval 10.0;
|
send_min_interval 10.0;
|
||||||
reduce_sequence_header on;
|
reduce_sequence_header on;
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,18 +817,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
||||||
srs_trace("vhost %s reload publish success.", vhost.c_str());
|
srs_trace("vhost %s reload publish success.", vhost.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// smi(send_min_interval), only one per vhost
|
|
||||||
if (!srs_directive_equals(new_vhost->get("send_min_interval"), old_vhost->get("send_min_interval"))) {
|
|
||||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
|
||||||
ISrsReloadHandler* subscribe = *it;
|
|
||||||
if ((ret = subscribe->on_reload_vhost_smi(vhost)) != ERROR_SUCCESS) {
|
|
||||||
srs_error("vhost %s notify subscribes smi failed. ret=%d", vhost.c_str(), ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
srs_trace("vhost %s reload smi success.", vhost.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// http_static, only one per vhost.
|
// http_static, only one per vhost.
|
||||||
if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) {
|
if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) {
|
||||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||||
|
@ -1699,14 +1687,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean());
|
obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
// stream control
|
|
||||||
if ((dir = vhost->get("send_min_interval")) != NULL) {
|
|
||||||
obj->set("send_min_interval", dir->dumps_arg0_to_number());
|
|
||||||
}
|
|
||||||
if ((dir = vhost->get("reduce_sequence_header")) != NULL) {
|
|
||||||
obj->set("reduce_sequence_header", dir->dumps_arg0_to_boolean());
|
|
||||||
}
|
|
||||||
|
|
||||||
// play
|
// play
|
||||||
if ((dir = vhost->get("play")) != NULL) {
|
if ((dir = vhost->get("play")) != NULL) {
|
||||||
SrsAmf0Object* play = SrsAmf0Any::object();
|
SrsAmf0Object* play = SrsAmf0Any::object();
|
||||||
|
@ -1729,6 +1709,10 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
play->set("gop_cache", sdir->dumps_arg0_to_boolean());
|
play->set("gop_cache", sdir->dumps_arg0_to_boolean());
|
||||||
} else if (sdir->name == "queue_length") {
|
} else if (sdir->name == "queue_length") {
|
||||||
play->set("queue_length", sdir->dumps_arg0_to_number());
|
play->set("queue_length", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "reduce_sequence_header") {
|
||||||
|
play->set("reduce_sequence_header", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "send_min_interval") {
|
||||||
|
play->set("send_min_interval", sdir->dumps_arg0_to_number());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2611,7 +2595,6 @@ int SrsConfig::check_config()
|
||||||
&& n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks"
|
&& n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks"
|
||||||
&& n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck"
|
&& n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck"
|
||||||
&& n != "debug_srs_upnode" && n != "play" && n != "publish"
|
&& n != "debug_srs_upnode" && n != "play" && n != "publish"
|
||||||
&& n != "send_min_interval" && n != "reduce_sequence_header"
|
|
||||||
&& n != "security" && n != "http_remux"
|
&& n != "security" && n != "http_remux"
|
||||||
&& n != "http_static" && n != "hds" && n != "exec"
|
&& n != "http_static" && n != "hds" && n != "exec"
|
||||||
) {
|
) {
|
||||||
|
@ -2652,8 +2635,8 @@ int SrsConfig::check_config()
|
||||||
} else if (n == "play") {
|
} else if (n == "play") {
|
||||||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||||
string m = conf->at(j)->name.c_str();
|
string m = conf->at(j)->name.c_str();
|
||||||
if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto"
|
if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto" && m != "mw_latency"
|
||||||
&& m != "mw_latency" && m != "gop_cache" && m != "queue_length"
|
&& m != "gop_cache" && m != "queue_length" && m != "send_min_interval" && m != "reduce_sequence_header"
|
||||||
) {
|
) {
|
||||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||||
srs_error("unsupported vhost play directive %s, ret=%d", m.c_str(), ret);
|
srs_error("unsupported vhost play directive %s, ret=%d", m.c_str(), ret);
|
||||||
|
@ -3505,6 +3488,11 @@ double SrsConfig::get_send_min_interval(string vhost)
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf = conf->get("play");
|
||||||
|
if (!conf || conf->arg0().empty()) {
|
||||||
|
return DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
conf = conf->get("send_min_interval");
|
conf = conf->get("send_min_interval");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
@ -3522,6 +3510,11 @@ bool SrsConfig::get_reduce_sequence_header(string vhost)
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf = conf->get("play");
|
||||||
|
if (!conf || conf->arg0().empty()) {
|
||||||
|
return DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
conf = conf->get("reduce_sequence_header");
|
conf = conf->get("reduce_sequence_header");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
@ -5768,7 +5761,8 @@ int srs_config_transform_vhost(SrsConfDirective* root)
|
||||||
// SRS3+:
|
// SRS3+:
|
||||||
// vhost { play { shadow; } }
|
// vhost { play { shadow; } }
|
||||||
if (n == "time_jitter" || n == "mix_correct" || n == "atc" || n == "atc_auto"
|
if (n == "time_jitter" || n == "mix_correct" || n == "atc" || n == "atc_auto"
|
||||||
|| n == "mw_latency" || n == "gop_cache" || n == "queue_length"
|
|| n == "mw_latency" || n == "gop_cache" || n == "queue_length" || n == "send_min_interval"
|
||||||
|
|| n == "reduce_sequence_header"
|
||||||
) {
|
) {
|
||||||
it = dir->directives.erase(it);
|
it = dir->directives.erase(it);
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,6 @@ int ISrsReloadHandler::on_reload_vhost_publish(string /*vhost*/)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ISrsReloadHandler::on_reload_vhost_smi(string /*vhost*/)
|
|
||||||
{
|
|
||||||
return ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ISrsReloadHandler::on_reload_vhost_tcp_nodelay(string /*vhost*/)
|
int ISrsReloadHandler::on_reload_vhost_tcp_nodelay(string /*vhost*/)
|
||||||
{
|
{
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
|
@ -70,7 +70,6 @@ public:
|
||||||
virtual int on_reload_vhost_hds(std::string vhost);
|
virtual int on_reload_vhost_hds(std::string vhost);
|
||||||
virtual int on_reload_vhost_dvr(std::string vhost);
|
virtual int on_reload_vhost_dvr(std::string vhost);
|
||||||
virtual int on_reload_vhost_publish(std::string vhost);
|
virtual int on_reload_vhost_publish(std::string vhost);
|
||||||
virtual int on_reload_vhost_smi(std::string vhost);
|
|
||||||
virtual int on_reload_vhost_tcp_nodelay(std::string vhost);
|
virtual int on_reload_vhost_tcp_nodelay(std::string vhost);
|
||||||
virtual int on_reload_vhost_realtime(std::string vhost);
|
virtual int on_reload_vhost_realtime(std::string vhost);
|
||||||
virtual int on_reload_vhost_chunk_size(std::string vhost);
|
virtual int on_reload_vhost_chunk_size(std::string vhost);
|
||||||
|
|
|
@ -238,24 +238,16 @@ int SrsRtmpConn::on_reload_vhost_play(string vhost)
|
||||||
if (req->vhost != vhost) {
|
if (req->vhost != vhost) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SrsRtmpConn::on_reload_vhost_smi(string vhost)
|
|
||||||
{
|
|
||||||
int ret = ERROR_SUCCESS;
|
|
||||||
|
|
||||||
if (req->vhost != vhost) {
|
// send_min_interval
|
||||||
return ret;
|
if (true) {
|
||||||
|
double v = _srs_config->get_send_min_interval(vhost);
|
||||||
|
if (v != send_min_interval) {
|
||||||
|
srs_trace("apply smi %.2f=>%.2f", send_min_interval, v);
|
||||||
|
send_min_interval = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double smi = _srs_config->get_send_min_interval(vhost);
|
|
||||||
if (smi != send_min_interval) {
|
|
||||||
srs_trace("apply smi %.2f=>%.2f", send_min_interval, smi);
|
|
||||||
send_min_interval = smi;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ protected:
|
||||||
public:
|
public:
|
||||||
virtual int on_reload_vhost_removed(std::string vhost);
|
virtual int on_reload_vhost_removed(std::string vhost);
|
||||||
virtual int on_reload_vhost_play(std::string vhost);
|
virtual int on_reload_vhost_play(std::string vhost);
|
||||||
virtual int on_reload_vhost_smi(std::string vhost);
|
|
||||||
virtual int on_reload_vhost_tcp_nodelay(std::string vhost);
|
virtual int on_reload_vhost_tcp_nodelay(std::string vhost);
|
||||||
virtual int on_reload_vhost_realtime(std::string vhost);
|
virtual int on_reload_vhost_realtime(std::string vhost);
|
||||||
virtual int on_reload_vhost_publish(std::string vhost);
|
virtual int on_reload_vhost_publish(std::string vhost);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue