diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index e65e721dc..adaea7d28 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -437,6 +437,21 @@ vhost play.srs.com { # the value recomment is [300, 1800] # default: 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 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 play { mw_latency 100; queue_length 10; + send_min_interval 10.0; + reduce_sequence_header on; } # @see publish.srs.com diff --git a/trunk/conf/full.one.vhost.conf b/trunk/conf/full.one.vhost.conf index 6cfa003ea..a48372f68 100644 --- a/trunk/conf/full.one.vhost.conf +++ b/trunk/conf/full.one.vhost.conf @@ -79,7 +79,6 @@ vhost vhost.srs.com { gop_cache off; queue_length 10; - # TODO send_min_interval 10.0; reduce_sequence_header on; } diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index fca35ef15..60e2513d5 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -817,18 +817,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) 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. if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) { 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()); } - // 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 if ((dir = vhost->get("play")) != NULL) { 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()); } else if (sdir->name == "queue_length") { 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 != "refer" && n != "forward" && n != "transcode" && n != "bandcheck" && n != "debug_srs_upnode" && n != "play" && n != "publish" - && n != "send_min_interval" && n != "reduce_sequence_header" && n != "security" && n != "http_remux" && n != "http_static" && n != "hds" && n != "exec" ) { @@ -2652,8 +2635,8 @@ int SrsConfig::check_config() } else if (n == "play") { for (int j = 0; j < (int)conf->directives.size(); j++) { string m = conf->at(j)->name.c_str(); - if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto" - && m != "mw_latency" && m != "gop_cache" && m != "queue_length" + 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" ) { ret = ERROR_SYSTEM_CONFIG_INVALID; 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; } + conf = conf->get("play"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + conf = conf->get("send_min_interval"); if (!conf || conf->arg0().empty()) { return DEFAULT; @@ -3522,6 +3510,11 @@ bool SrsConfig::get_reduce_sequence_header(string vhost) return DEFAULT; } + conf = conf->get("play"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + conf = conf->get("reduce_sequence_header"); if (!conf || conf->arg0().empty()) { return DEFAULT; @@ -5768,7 +5761,8 @@ int srs_config_transform_vhost(SrsConfDirective* root) // SRS3+: // vhost { play { shadow; } } 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); diff --git a/trunk/src/app/srs_app_reload.cpp b/trunk/src/app/srs_app_reload.cpp index 85b90e1ae..3afaef5fd 100644 --- a/trunk/src/app/srs_app_reload.cpp +++ b/trunk/src/app/srs_app_reload.cpp @@ -155,11 +155,6 @@ int ISrsReloadHandler::on_reload_vhost_publish(string /*vhost*/) return ERROR_SUCCESS; } -int ISrsReloadHandler::on_reload_vhost_smi(string /*vhost*/) -{ - return ERROR_SUCCESS; -} - int ISrsReloadHandler::on_reload_vhost_tcp_nodelay(string /*vhost*/) { return ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_reload.hpp b/trunk/src/app/srs_app_reload.hpp index 1c34e4b1e..0e094886e 100644 --- a/trunk/src/app/srs_app_reload.hpp +++ b/trunk/src/app/srs_app_reload.hpp @@ -70,7 +70,6 @@ public: virtual int on_reload_vhost_hds(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_smi(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_chunk_size(std::string vhost); diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index f4f8996b4..c56e9e8e3 100755 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -238,24 +238,16 @@ int SrsRtmpConn::on_reload_vhost_play(string vhost) if (req->vhost != vhost) { return ret; } - - return ret; -} - -int SrsRtmpConn::on_reload_vhost_smi(string vhost) -{ - int ret = ERROR_SUCCESS; - if (req->vhost != vhost) { - return ret; + // send_min_interval + 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; } diff --git a/trunk/src/app/srs_app_rtmp_conn.hpp b/trunk/src/app/srs_app_rtmp_conn.hpp index 073125ffe..926d03f4a 100755 --- a/trunk/src/app/srs_app_rtmp_conn.hpp +++ b/trunk/src/app/srs_app_rtmp_conn.hpp @@ -104,7 +104,6 @@ protected: public: virtual int on_reload_vhost_removed(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_realtime(std::string vhost); virtual int on_reload_vhost_publish(std::string vhost);