正在显示
7 个修改的文件
包含
43 行增加
和
63 行删除
| @@ -437,6 +437,21 @@ vhost play.srs.com { | @@ -437,6 +437,21 @@ vhost play.srs.com { | ||
| 437 | # the value recomment is [300, 1800] | 437 | # the value recomment is [300, 1800] |
| 438 | # default: 350 | 438 | # default: 350 |
| 439 | mw_latency 350; | 439 | mw_latency 350; |
| 440 | + | ||
| 441 | + # the minimal packets send interval in ms, | ||
| 442 | + # used to control the ndiff of stream by srs_rtmp_dump, | ||
| 443 | + # for example, some device can only accept some stream which | ||
| 444 | + # delivery packets in constant interval(not cbr). | ||
| 445 | + # @remark 0 to disable the minimal interval. | ||
| 446 | + # @remark >0 to make the srs to send message one by one. | ||
| 447 | + # @remark user can get the right packets interval in ms by srs_rtmp_dump. | ||
| 448 | + # default: 0 | ||
| 449 | + send_min_interval 10.0; | ||
| 450 | + # whether reduce the sequence header, | ||
| 451 | + # for some client which cannot got duplicated sequence header, | ||
| 452 | + # while the sequence header is not changed yet. | ||
| 453 | + # default: off | ||
| 454 | + reduce_sequence_header on; | ||
| 440 | } | 455 | } |
| 441 | } | 456 | } |
| 442 | 457 | ||
| @@ -501,25 +516,12 @@ vhost stream.control.com { | @@ -501,25 +516,12 @@ vhost stream.control.com { | ||
| 501 | # @see scope.vhost.srs.com | 516 | # @see scope.vhost.srs.com |
| 502 | tcp_nodelay on; | 517 | tcp_nodelay on; |
| 503 | 518 | ||
| 504 | - # the minimal packets send interval in ms, | ||
| 505 | - # used to control the ndiff of stream by srs_rtmp_dump, | ||
| 506 | - # for example, some device can only accept some stream which | ||
| 507 | - # delivery packets in constant interval(not cbr). | ||
| 508 | - # @remark 0 to disable the minimal interval. | ||
| 509 | - # @remark >0 to make the srs to send message one by one. | ||
| 510 | - # @remark user can get the right packets interval in ms by srs_rtmp_dump. | ||
| 511 | - # default: 0 | ||
| 512 | - send_min_interval 10.0; | ||
| 513 | - # whether reduce the sequence header, | ||
| 514 | - # for some client which cannot got duplicated sequence header, | ||
| 515 | - # while the sequence header is not changed yet. | ||
| 516 | - # default: off | ||
| 517 | - reduce_sequence_header on; | ||
| 518 | - | ||
| 519 | # @see play.srs.com | 519 | # @see play.srs.com |
| 520 | play { | 520 | play { |
| 521 | mw_latency 100; | 521 | mw_latency 100; |
| 522 | queue_length 10; | 522 | queue_length 10; |
| 523 | + send_min_interval 10.0; | ||
| 524 | + reduce_sequence_header on; | ||
| 523 | } | 525 | } |
| 524 | 526 | ||
| 525 | # @see publish.srs.com | 527 | # @see publish.srs.com |
| @@ -817,18 +817,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | @@ -817,18 +817,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | ||
| 817 | srs_trace("vhost %s reload publish success.", vhost.c_str()); | 817 | srs_trace("vhost %s reload publish success.", vhost.c_str()); |
| 818 | } | 818 | } |
| 819 | 819 | ||
| 820 | - // smi(send_min_interval), only one per vhost | ||
| 821 | - if (!srs_directive_equals(new_vhost->get("send_min_interval"), old_vhost->get("send_min_interval"))) { | ||
| 822 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 823 | - ISrsReloadHandler* subscribe = *it; | ||
| 824 | - if ((ret = subscribe->on_reload_vhost_smi(vhost)) != ERROR_SUCCESS) { | ||
| 825 | - srs_error("vhost %s notify subscribes smi failed. ret=%d", vhost.c_str(), ret); | ||
| 826 | - return ret; | ||
| 827 | - } | ||
| 828 | - } | ||
| 829 | - srs_trace("vhost %s reload smi success.", vhost.c_str()); | ||
| 830 | - } | ||
| 831 | - | ||
| 832 | // http_static, only one per vhost. | 820 | // http_static, only one per vhost. |
| 833 | if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) { | 821 | if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) { |
| 834 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 822 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| @@ -1699,14 +1687,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | @@ -1699,14 +1687,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | ||
| 1699 | obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean()); | 1687 | obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean()); |
| 1700 | } | 1688 | } |
| 1701 | 1689 | ||
| 1702 | - // stream control | ||
| 1703 | - if ((dir = vhost->get("send_min_interval")) != NULL) { | ||
| 1704 | - obj->set("send_min_interval", dir->dumps_arg0_to_number()); | ||
| 1705 | - } | ||
| 1706 | - if ((dir = vhost->get("reduce_sequence_header")) != NULL) { | ||
| 1707 | - obj->set("reduce_sequence_header", dir->dumps_arg0_to_boolean()); | ||
| 1708 | - } | ||
| 1709 | - | ||
| 1710 | // play | 1690 | // play |
| 1711 | if ((dir = vhost->get("play")) != NULL) { | 1691 | if ((dir = vhost->get("play")) != NULL) { |
| 1712 | SrsAmf0Object* play = SrsAmf0Any::object(); | 1692 | SrsAmf0Object* play = SrsAmf0Any::object(); |
| @@ -1729,6 +1709,10 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | @@ -1729,6 +1709,10 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | ||
| 1729 | play->set("gop_cache", sdir->dumps_arg0_to_boolean()); | 1709 | play->set("gop_cache", sdir->dumps_arg0_to_boolean()); |
| 1730 | } else if (sdir->name == "queue_length") { | 1710 | } else if (sdir->name == "queue_length") { |
| 1731 | play->set("queue_length", sdir->dumps_arg0_to_number()); | 1711 | play->set("queue_length", sdir->dumps_arg0_to_number()); |
| 1712 | + } else if (sdir->name == "reduce_sequence_header") { | ||
| 1713 | + play->set("reduce_sequence_header", sdir->dumps_arg0_to_boolean()); | ||
| 1714 | + } else if (sdir->name == "send_min_interval") { | ||
| 1715 | + play->set("send_min_interval", sdir->dumps_arg0_to_number()); | ||
| 1732 | } | 1716 | } |
| 1733 | } | 1717 | } |
| 1734 | } | 1718 | } |
| @@ -2611,7 +2595,6 @@ int SrsConfig::check_config() | @@ -2611,7 +2595,6 @@ int SrsConfig::check_config() | ||
| 2611 | && n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks" | 2595 | && n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks" |
| 2612 | && n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck" | 2596 | && n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck" |
| 2613 | && n != "debug_srs_upnode" && n != "play" && n != "publish" | 2597 | && n != "debug_srs_upnode" && n != "play" && n != "publish" |
| 2614 | - && n != "send_min_interval" && n != "reduce_sequence_header" | ||
| 2615 | && n != "security" && n != "http_remux" | 2598 | && n != "security" && n != "http_remux" |
| 2616 | && n != "http_static" && n != "hds" && n != "exec" | 2599 | && n != "http_static" && n != "hds" && n != "exec" |
| 2617 | ) { | 2600 | ) { |
| @@ -2652,8 +2635,8 @@ int SrsConfig::check_config() | @@ -2652,8 +2635,8 @@ int SrsConfig::check_config() | ||
| 2652 | } else if (n == "play") { | 2635 | } else if (n == "play") { |
| 2653 | for (int j = 0; j < (int)conf->directives.size(); j++) { | 2636 | for (int j = 0; j < (int)conf->directives.size(); j++) { |
| 2654 | string m = conf->at(j)->name.c_str(); | 2637 | string m = conf->at(j)->name.c_str(); |
| 2655 | - if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto" | ||
| 2656 | - && m != "mw_latency" && m != "gop_cache" && m != "queue_length" | 2638 | + if (m != "time_jitter" && m != "mix_correct" && m != "atc" && m != "atc_auto" && m != "mw_latency" |
| 2639 | + && m != "gop_cache" && m != "queue_length" && m != "send_min_interval" && m != "reduce_sequence_header" | ||
| 2657 | ) { | 2640 | ) { |
| 2658 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 2641 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| 2659 | srs_error("unsupported vhost play directive %s, ret=%d", m.c_str(), ret); | 2642 | 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) | @@ -3505,6 +3488,11 @@ double SrsConfig::get_send_min_interval(string vhost) | ||
| 3505 | return DEFAULT; | 3488 | return DEFAULT; |
| 3506 | } | 3489 | } |
| 3507 | 3490 | ||
| 3491 | + conf = conf->get("play"); | ||
| 3492 | + if (!conf || conf->arg0().empty()) { | ||
| 3493 | + return DEFAULT; | ||
| 3494 | + } | ||
| 3495 | + | ||
| 3508 | conf = conf->get("send_min_interval"); | 3496 | conf = conf->get("send_min_interval"); |
| 3509 | if (!conf || conf->arg0().empty()) { | 3497 | if (!conf || conf->arg0().empty()) { |
| 3510 | return DEFAULT; | 3498 | return DEFAULT; |
| @@ -3522,6 +3510,11 @@ bool SrsConfig::get_reduce_sequence_header(string vhost) | @@ -3522,6 +3510,11 @@ bool SrsConfig::get_reduce_sequence_header(string vhost) | ||
| 3522 | return DEFAULT; | 3510 | return DEFAULT; |
| 3523 | } | 3511 | } |
| 3524 | 3512 | ||
| 3513 | + conf = conf->get("play"); | ||
| 3514 | + if (!conf || conf->arg0().empty()) { | ||
| 3515 | + return DEFAULT; | ||
| 3516 | + } | ||
| 3517 | + | ||
| 3525 | conf = conf->get("reduce_sequence_header"); | 3518 | conf = conf->get("reduce_sequence_header"); |
| 3526 | if (!conf || conf->arg0().empty()) { | 3519 | if (!conf || conf->arg0().empty()) { |
| 3527 | return DEFAULT; | 3520 | return DEFAULT; |
| @@ -5768,7 +5761,8 @@ int srs_config_transform_vhost(SrsConfDirective* root) | @@ -5768,7 +5761,8 @@ int srs_config_transform_vhost(SrsConfDirective* root) | ||
| 5768 | // SRS3+: | 5761 | // SRS3+: |
| 5769 | // vhost { play { shadow; } } | 5762 | // vhost { play { shadow; } } |
| 5770 | if (n == "time_jitter" || n == "mix_correct" || n == "atc" || n == "atc_auto" | 5763 | if (n == "time_jitter" || n == "mix_correct" || n == "atc" || n == "atc_auto" |
| 5771 | - || n == "mw_latency" || n == "gop_cache" || n == "queue_length" | 5764 | + || n == "mw_latency" || n == "gop_cache" || n == "queue_length" || n == "send_min_interval" |
| 5765 | + || n == "reduce_sequence_header" | ||
| 5772 | ) { | 5766 | ) { |
| 5773 | it = dir->directives.erase(it); | 5767 | it = dir->directives.erase(it); |
| 5774 | 5768 |
| @@ -155,11 +155,6 @@ int ISrsReloadHandler::on_reload_vhost_publish(string /*vhost*/) | @@ -155,11 +155,6 @@ int ISrsReloadHandler::on_reload_vhost_publish(string /*vhost*/) | ||
| 155 | return ERROR_SUCCESS; | 155 | return ERROR_SUCCESS; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | -int ISrsReloadHandler::on_reload_vhost_smi(string /*vhost*/) | ||
| 159 | -{ | ||
| 160 | - return ERROR_SUCCESS; | ||
| 161 | -} | ||
| 162 | - | ||
| 163 | int ISrsReloadHandler::on_reload_vhost_tcp_nodelay(string /*vhost*/) | 158 | int ISrsReloadHandler::on_reload_vhost_tcp_nodelay(string /*vhost*/) |
| 164 | { | 159 | { |
| 165 | return ERROR_SUCCESS; | 160 | return ERROR_SUCCESS; |
| @@ -70,7 +70,6 @@ public: | @@ -70,7 +70,6 @@ public: | ||
| 70 | virtual int on_reload_vhost_hds(std::string vhost); | 70 | virtual int on_reload_vhost_hds(std::string vhost); |
| 71 | virtual int on_reload_vhost_dvr(std::string vhost); | 71 | virtual int on_reload_vhost_dvr(std::string vhost); |
| 72 | virtual int on_reload_vhost_publish(std::string vhost); | 72 | virtual int on_reload_vhost_publish(std::string vhost); |
| 73 | - virtual int on_reload_vhost_smi(std::string vhost); | ||
| 74 | virtual int on_reload_vhost_tcp_nodelay(std::string vhost); | 73 | virtual int on_reload_vhost_tcp_nodelay(std::string vhost); |
| 75 | virtual int on_reload_vhost_realtime(std::string vhost); | 74 | virtual int on_reload_vhost_realtime(std::string vhost); |
| 76 | virtual int on_reload_vhost_chunk_size(std::string vhost); | 75 | virtual int on_reload_vhost_chunk_size(std::string vhost); |
| @@ -238,24 +238,16 @@ int SrsRtmpConn::on_reload_vhost_play(string vhost) | @@ -238,24 +238,16 @@ int SrsRtmpConn::on_reload_vhost_play(string vhost) | ||
| 238 | if (req->vhost != vhost) { | 238 | if (req->vhost != vhost) { |
| 239 | return ret; | 239 | return ret; |
| 240 | } | 240 | } |
| 241 | - | ||
| 242 | - return ret; | ||
| 243 | -} | ||
| 244 | - | ||
| 245 | -int SrsRtmpConn::on_reload_vhost_smi(string vhost) | ||
| 246 | -{ | ||
| 247 | - int ret = ERROR_SUCCESS; | ||
| 248 | - | ||
| 249 | - if (req->vhost != vhost) { | ||
| 250 | - return ret; | ||
| 251 | - } | ||
| 252 | 241 | ||
| 253 | - double smi = _srs_config->get_send_min_interval(vhost); | ||
| 254 | - if (smi != send_min_interval) { | ||
| 255 | - srs_trace("apply smi %.2f=>%.2f", send_min_interval, smi); | ||
| 256 | - send_min_interval = smi; | 242 | + // send_min_interval |
| 243 | + if (true) { | ||
| 244 | + double v = _srs_config->get_send_min_interval(vhost); | ||
| 245 | + if (v != send_min_interval) { | ||
| 246 | + srs_trace("apply smi %.2f=>%.2f", send_min_interval, v); | ||
| 247 | + send_min_interval = v; | ||
| 248 | + } | ||
| 257 | } | 249 | } |
| 258 | - | 250 | + |
| 259 | return ret; | 251 | return ret; |
| 260 | } | 252 | } |
| 261 | 253 |
| @@ -104,7 +104,6 @@ protected: | @@ -104,7 +104,6 @@ protected: | ||
| 104 | public: | 104 | public: |
| 105 | virtual int on_reload_vhost_removed(std::string vhost); | 105 | virtual int on_reload_vhost_removed(std::string vhost); |
| 106 | virtual int on_reload_vhost_play(std::string vhost); | 106 | virtual int on_reload_vhost_play(std::string vhost); |
| 107 | - virtual int on_reload_vhost_smi(std::string vhost); | ||
| 108 | virtual int on_reload_vhost_tcp_nodelay(std::string vhost); | 107 | virtual int on_reload_vhost_tcp_nodelay(std::string vhost); |
| 109 | virtual int on_reload_vhost_realtime(std::string vhost); | 108 | virtual int on_reload_vhost_realtime(std::string vhost); |
| 110 | virtual int on_reload_vhost_publish(std::string vhost); | 109 | virtual int on_reload_vhost_publish(std::string vhost); |
-
请 注册 或 登录 后发表评论