正在显示
3 个修改的文件
包含
26 行增加
和
8 行删除
| @@ -1587,27 +1587,38 @@ SrsConfDirective* SrsConfig::get_refer_publish(string vhost) | @@ -1587,27 +1587,38 @@ SrsConfDirective* SrsConfig::get_refer_publish(string vhost) | ||
| 1587 | 1587 | ||
| 1588 | int SrsConfig::get_chunk_size(string vhost) | 1588 | int SrsConfig::get_chunk_size(string vhost) |
| 1589 | { | 1589 | { |
| 1590 | + if (vhost.empty()) { | ||
| 1591 | + return get_global_chunk_size(); | ||
| 1592 | + } | ||
| 1593 | + | ||
| 1590 | SrsConfDirective* conf = get_vhost(vhost); | 1594 | SrsConfDirective* conf = get_vhost(vhost); |
| 1591 | 1595 | ||
| 1592 | if (!conf) { | 1596 | if (!conf) { |
| 1593 | - return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE; | 1597 | + // vhost does not specify the chunk size, |
| 1598 | + // use the global instead. | ||
| 1599 | + return get_global_chunk_size(); | ||
| 1594 | } | 1600 | } |
| 1595 | 1601 | ||
| 1596 | conf = conf->get("chunk_size"); | 1602 | conf = conf->get("chunk_size"); |
| 1597 | if (!conf) { | 1603 | if (!conf) { |
| 1598 | // vhost does not specify the chunk size, | 1604 | // vhost does not specify the chunk size, |
| 1599 | // use the global instead. | 1605 | // use the global instead. |
| 1600 | - conf = root->get("chunk_size"); | ||
| 1601 | - if (!conf) { | ||
| 1602 | - return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE; | ||
| 1603 | - } | ||
| 1604 | - | ||
| 1605 | - return ::atoi(conf->arg0().c_str()); | 1606 | + return get_global_chunk_size(); |
| 1606 | } | 1607 | } |
| 1607 | 1608 | ||
| 1608 | return ::atoi(conf->arg0().c_str()); | 1609 | return ::atoi(conf->arg0().c_str()); |
| 1609 | } | 1610 | } |
| 1610 | 1611 | ||
| 1612 | +int SrsConfig::get_global_chunk_size() | ||
| 1613 | +{ | ||
| 1614 | + SrsConfDirective* conf = root->get("chunk_size"); | ||
| 1615 | + if (!conf) { | ||
| 1616 | + return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE; | ||
| 1617 | + } | ||
| 1618 | + | ||
| 1619 | + return ::atoi(conf->arg0().c_str()); | ||
| 1620 | +} | ||
| 1621 | + | ||
| 1611 | SrsConfDirective* SrsConfig::get_forward(string vhost) | 1622 | SrsConfDirective* SrsConfig::get_forward(string vhost) |
| 1612 | { | 1623 | { |
| 1613 | SrsConfDirective* conf = get_vhost(vhost); | 1624 | SrsConfDirective* conf = get_vhost(vhost); |
| @@ -490,12 +490,19 @@ public: | @@ -490,12 +490,19 @@ public: | ||
| 490 | virtual SrsConfDirective* get_refer_publish(std::string vhost); | 490 | virtual SrsConfDirective* get_refer_publish(std::string vhost); |
| 491 | /** | 491 | /** |
| 492 | * get the chunk size of vhost. | 492 | * get the chunk size of vhost. |
| 493 | + * @param vhost, the vhost to get the chunk size. use global if not specified. | ||
| 494 | + * empty string to get the global. | ||
| 493 | */ | 495 | */ |
| 494 | virtual int get_chunk_size(std::string vhost); | 496 | virtual int get_chunk_size(std::string vhost); |
| 497 | +private: | ||
| 498 | + /** | ||
| 499 | + * get the global chunk size. | ||
| 500 | + */ | ||
| 501 | + virtual int get_global_chunk_size(); | ||
| 495 | // forward section | 502 | // forward section |
| 496 | public: | 503 | public: |
| 497 | /** | 504 | /** |
| 498 | - * | 505 | + * get the forward directive of vhost. |
| 499 | */ | 506 | */ |
| 500 | virtual SrsConfDirective* get_forward(std::string vhost); | 507 | virtual SrsConfDirective* get_forward(std::string vhost); |
| 501 | // http_hooks section | 508 | // http_hooks section |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论