正在显示
2 个修改的文件
包含
199 行增加
和
177 行删除
| @@ -1431,91 +1431,113 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts() | @@ -1431,91 +1431,113 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts() | ||
| 1431 | return vhosts; | 1431 | return vhosts; |
| 1432 | } | 1432 | } |
| 1433 | 1433 | ||
| 1434 | -SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) | 1434 | +bool SrsConfig::get_vhost_enabled(string vhost) |
| 1435 | { | 1435 | { |
| 1436 | - SrsConfDirective* conf = get_vhost(vhost); | 1436 | + SrsConfDirective* vhost_conf = get_vhost(vhost); |
| 1437 | 1437 | ||
| 1438 | - if (!conf) { | ||
| 1439 | - return NULL; | 1438 | + return get_vhost_enabled(vhost_conf); |
| 1439 | +} | ||
| 1440 | + | ||
| 1441 | +bool SrsConfig::get_vhost_enabled(SrsConfDirective* vhost) | ||
| 1442 | +{ | ||
| 1443 | + if (!vhost) { | ||
| 1444 | + return false; | ||
| 1440 | } | 1445 | } |
| 1441 | 1446 | ||
| 1442 | - conf = conf->get("http_hooks"); | 1447 | + SrsConfDirective* conf = vhost->get("enabled"); |
| 1443 | if (!conf) { | 1448 | if (!conf) { |
| 1444 | - return NULL; | 1449 | + return true; |
| 1445 | } | 1450 | } |
| 1446 | 1451 | ||
| 1447 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1448 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1449 | - return NULL; | 1452 | + if (conf->arg0() == "off") { |
| 1453 | + return false; | ||
| 1450 | } | 1454 | } |
| 1451 | 1455 | ||
| 1452 | - return conf->get("on_connect"); | 1456 | + return true; |
| 1453 | } | 1457 | } |
| 1454 | 1458 | ||
| 1455 | -SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost) | 1459 | +bool SrsConfig::get_gop_cache(string vhost) |
| 1456 | { | 1460 | { |
| 1457 | SrsConfDirective* conf = get_vhost(vhost); | 1461 | SrsConfDirective* conf = get_vhost(vhost); |
| 1458 | 1462 | ||
| 1459 | if (!conf) { | 1463 | if (!conf) { |
| 1460 | - return NULL; | 1464 | + return true; |
| 1461 | } | 1465 | } |
| 1462 | 1466 | ||
| 1463 | - conf = conf->get("http_hooks"); | 1467 | + conf = conf->get("gop_cache"); |
| 1468 | + if (conf && conf->arg0() == "off") { | ||
| 1469 | + return false; | ||
| 1470 | + } | ||
| 1471 | + | ||
| 1472 | + return true; | ||
| 1473 | +} | ||
| 1474 | + | ||
| 1475 | +bool SrsConfig::get_atc(string vhost) | ||
| 1476 | +{ | ||
| 1477 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1478 | + | ||
| 1464 | if (!conf) { | 1479 | if (!conf) { |
| 1465 | - return NULL; | 1480 | + return false; |
| 1466 | } | 1481 | } |
| 1467 | 1482 | ||
| 1468 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1469 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1470 | - return NULL; | 1483 | + conf = conf->get("atc"); |
| 1484 | + if (conf && conf->arg0() == "on") { | ||
| 1485 | + return true; | ||
| 1471 | } | 1486 | } |
| 1472 | 1487 | ||
| 1473 | - return conf->get("on_close"); | 1488 | + return false; |
| 1474 | } | 1489 | } |
| 1475 | 1490 | ||
| 1476 | -SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost) | 1491 | +bool SrsConfig::get_atc_auto(string vhost) |
| 1477 | { | 1492 | { |
| 1478 | SrsConfDirective* conf = get_vhost(vhost); | 1493 | SrsConfDirective* conf = get_vhost(vhost); |
| 1479 | 1494 | ||
| 1480 | if (!conf) { | 1495 | if (!conf) { |
| 1481 | - return NULL; | 1496 | + return true; |
| 1482 | } | 1497 | } |
| 1483 | 1498 | ||
| 1484 | - conf = conf->get("http_hooks"); | ||
| 1485 | - if (!conf) { | ||
| 1486 | - return NULL; | 1499 | + conf = conf->get("atc_auto"); |
| 1500 | + if (conf && conf->arg0() == "off") { | ||
| 1501 | + return false; | ||
| 1487 | } | 1502 | } |
| 1488 | 1503 | ||
| 1489 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1490 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1491 | - return NULL; | 1504 | + return true; |
| 1505 | +} | ||
| 1506 | + | ||
| 1507 | +int SrsConfig::get_time_jitter(string vhost) | ||
| 1508 | +{ | ||
| 1509 | + SrsConfDirective* dvr = get_vhost(vhost); | ||
| 1510 | + | ||
| 1511 | + std::string time_jitter = SRS_CONF_DEFAULT_TIME_JITTER; | ||
| 1512 | + | ||
| 1513 | + if (dvr) { | ||
| 1514 | + SrsConfDirective* conf = dvr->get("time_jitter"); | ||
| 1515 | + | ||
| 1516 | + if (conf) { | ||
| 1517 | + time_jitter = conf->arg0(); | ||
| 1518 | + } | ||
| 1492 | } | 1519 | } |
| 1493 | 1520 | ||
| 1494 | - return conf->get("on_publish"); | 1521 | + return _srs_time_jitter_string2int(time_jitter); |
| 1495 | } | 1522 | } |
| 1496 | 1523 | ||
| 1497 | -SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost) | 1524 | +double SrsConfig::get_queue_length(string vhost) |
| 1498 | { | 1525 | { |
| 1499 | SrsConfDirective* conf = get_vhost(vhost); | 1526 | SrsConfDirective* conf = get_vhost(vhost); |
| 1500 | 1527 | ||
| 1501 | if (!conf) { | 1528 | if (!conf) { |
| 1502 | - return NULL; | ||
| 1503 | - } | ||
| 1504 | - | ||
| 1505 | - conf = conf->get("http_hooks"); | ||
| 1506 | - if (!conf) { | ||
| 1507 | - return NULL; | 1529 | + return SRS_CONF_DEFAULT_QUEUE_LENGTH; |
| 1508 | } | 1530 | } |
| 1509 | 1531 | ||
| 1510 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1511 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1512 | - return NULL; | 1532 | + conf = conf->get("queue_length"); |
| 1533 | + if (!conf || conf->arg0().empty()) { | ||
| 1534 | + return SRS_CONF_DEFAULT_QUEUE_LENGTH; | ||
| 1513 | } | 1535 | } |
| 1514 | 1536 | ||
| 1515 | - return conf->get("on_unpublish"); | 1537 | + return ::atoi(conf->arg0().c_str()); |
| 1516 | } | 1538 | } |
| 1517 | 1539 | ||
| 1518 | -SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) | 1540 | +SrsConfDirective* SrsConfig::get_refer(string vhost) |
| 1519 | { | 1541 | { |
| 1520 | SrsConfDirective* conf = get_vhost(vhost); | 1542 | SrsConfDirective* conf = get_vhost(vhost); |
| 1521 | 1543 | ||
| @@ -1523,41 +1545,66 @@ SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) | @@ -1523,41 +1545,66 @@ SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) | ||
| 1523 | return NULL; | 1545 | return NULL; |
| 1524 | } | 1546 | } |
| 1525 | 1547 | ||
| 1526 | - conf = conf->get("http_hooks"); | 1548 | + return conf->get("refer"); |
| 1549 | +} | ||
| 1550 | + | ||
| 1551 | +SrsConfDirective* SrsConfig::get_refer_play(string vhost) | ||
| 1552 | +{ | ||
| 1553 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1554 | + | ||
| 1527 | if (!conf) { | 1555 | if (!conf) { |
| 1528 | return NULL; | 1556 | return NULL; |
| 1529 | } | 1557 | } |
| 1530 | 1558 | ||
| 1531 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1532 | - if (!enabled || enabled->arg0() != "on") { | 1559 | + return conf->get("refer_play"); |
| 1560 | +} | ||
| 1561 | + | ||
| 1562 | +SrsConfDirective* SrsConfig::get_refer_publish(string vhost) | ||
| 1563 | +{ | ||
| 1564 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1565 | + | ||
| 1566 | + if (!conf) { | ||
| 1533 | return NULL; | 1567 | return NULL; |
| 1534 | } | 1568 | } |
| 1535 | 1569 | ||
| 1536 | - return conf->get("on_play"); | 1570 | + return conf->get("refer_publish"); |
| 1537 | } | 1571 | } |
| 1538 | 1572 | ||
| 1539 | -SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost) | 1573 | +int SrsConfig::get_chunk_size(const string &vhost) |
| 1540 | { | 1574 | { |
| 1541 | SrsConfDirective* conf = get_vhost(vhost); | 1575 | SrsConfDirective* conf = get_vhost(vhost); |
| 1542 | 1576 | ||
| 1543 | if (!conf) { | 1577 | if (!conf) { |
| 1544 | - return NULL; | 1578 | + return SRS_CONF_DEFAULT_CHUNK_SIZE; |
| 1545 | } | 1579 | } |
| 1546 | 1580 | ||
| 1547 | - conf = conf->get("http_hooks"); | 1581 | + conf = conf->get("chunk_size"); |
| 1548 | if (!conf) { | 1582 | if (!conf) { |
| 1549 | - return NULL; | 1583 | + // vhost does not specify the chunk size, |
| 1584 | + // use the global instead. | ||
| 1585 | + conf = root->get("chunk_size"); | ||
| 1586 | + if (!conf) { | ||
| 1587 | + return SRS_CONF_DEFAULT_CHUNK_SIZE; | ||
| 1550 | } | 1588 | } |
| 1551 | 1589 | ||
| 1552 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1553 | - if (!enabled || enabled->arg0() != "on") { | 1590 | + return ::atoi(conf->arg0().c_str()); |
| 1591 | + } | ||
| 1592 | + | ||
| 1593 | + return ::atoi(conf->arg0().c_str()); | ||
| 1594 | +} | ||
| 1595 | + | ||
| 1596 | +SrsConfDirective* SrsConfig::get_forward(string vhost) | ||
| 1597 | +{ | ||
| 1598 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1599 | + | ||
| 1600 | + if (!conf) { | ||
| 1554 | return NULL; | 1601 | return NULL; |
| 1555 | } | 1602 | } |
| 1556 | 1603 | ||
| 1557 | - return conf->get("on_stop"); | 1604 | + return conf->get("forward"); |
| 1558 | } | 1605 | } |
| 1559 | 1606 | ||
| 1560 | -SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) | 1607 | +SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) |
| 1561 | { | 1608 | { |
| 1562 | SrsConfDirective* conf = get_vhost(vhost); | 1609 | SrsConfDirective* conf = get_vhost(vhost); |
| 1563 | 1610 | ||
| @@ -1575,127 +1622,94 @@ SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) | @@ -1575,127 +1622,94 @@ SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) | ||
| 1575 | return NULL; | 1622 | return NULL; |
| 1576 | } | 1623 | } |
| 1577 | 1624 | ||
| 1578 | - return conf->get("on_dvr_hss_reap_flv"); | 1625 | + return conf->get("on_connect"); |
| 1579 | } | 1626 | } |
| 1580 | 1627 | ||
| 1581 | -bool SrsConfig::get_vhost_enabled(string vhost) | 1628 | +SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost) |
| 1582 | { | 1629 | { |
| 1583 | - SrsConfDirective* vhost_conf = get_vhost(vhost); | ||
| 1584 | - | ||
| 1585 | - return get_vhost_enabled(vhost_conf); | ||
| 1586 | -} | 1630 | + SrsConfDirective* conf = get_vhost(vhost); |
| 1587 | 1631 | ||
| 1588 | -bool SrsConfig::get_vhost_enabled(SrsConfDirective* vhost) | ||
| 1589 | -{ | ||
| 1590 | - if (!vhost) { | ||
| 1591 | - return false; | 1632 | + if (!conf) { |
| 1633 | + return NULL; | ||
| 1592 | } | 1634 | } |
| 1593 | 1635 | ||
| 1594 | - SrsConfDirective* conf = vhost->get("enabled"); | 1636 | + conf = conf->get("http_hooks"); |
| 1595 | if (!conf) { | 1637 | if (!conf) { |
| 1596 | - return true; | 1638 | + return NULL; |
| 1597 | } | 1639 | } |
| 1598 | 1640 | ||
| 1599 | - if (conf->arg0() == "off") { | ||
| 1600 | - return false; | 1641 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1642 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1643 | + return NULL; | ||
| 1601 | } | 1644 | } |
| 1602 | 1645 | ||
| 1603 | - return true; | 1646 | + return conf->get("on_close"); |
| 1604 | } | 1647 | } |
| 1605 | 1648 | ||
| 1606 | -bool SrsConfig::get_gop_cache(string vhost) | 1649 | +SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost) |
| 1607 | { | 1650 | { |
| 1608 | SrsConfDirective* conf = get_vhost(vhost); | 1651 | SrsConfDirective* conf = get_vhost(vhost); |
| 1609 | 1652 | ||
| 1610 | if (!conf) { | 1653 | if (!conf) { |
| 1611 | - return true; | ||
| 1612 | - } | ||
| 1613 | - | ||
| 1614 | - conf = conf->get("gop_cache"); | ||
| 1615 | - if (conf && conf->arg0() == "off") { | ||
| 1616 | - return false; | 1654 | + return NULL; |
| 1617 | } | 1655 | } |
| 1618 | 1656 | ||
| 1619 | - return true; | ||
| 1620 | -} | ||
| 1621 | - | ||
| 1622 | -bool SrsConfig::get_atc(string vhost) | ||
| 1623 | -{ | ||
| 1624 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1625 | - | 1657 | + conf = conf->get("http_hooks"); |
| 1626 | if (!conf) { | 1658 | if (!conf) { |
| 1627 | - return false; | 1659 | + return NULL; |
| 1628 | } | 1660 | } |
| 1629 | 1661 | ||
| 1630 | - conf = conf->get("atc"); | ||
| 1631 | - if (conf && conf->arg0() == "on") { | ||
| 1632 | - return true; | 1662 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1663 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1664 | + return NULL; | ||
| 1633 | } | 1665 | } |
| 1634 | 1666 | ||
| 1635 | - return false; | 1667 | + return conf->get("on_publish"); |
| 1636 | } | 1668 | } |
| 1637 | 1669 | ||
| 1638 | -bool SrsConfig::get_atc_auto(string vhost) | 1670 | +SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost) |
| 1639 | { | 1671 | { |
| 1640 | SrsConfDirective* conf = get_vhost(vhost); | 1672 | SrsConfDirective* conf = get_vhost(vhost); |
| 1641 | 1673 | ||
| 1642 | if (!conf) { | 1674 | if (!conf) { |
| 1643 | - return true; | 1675 | + return NULL; |
| 1644 | } | 1676 | } |
| 1645 | 1677 | ||
| 1646 | - conf = conf->get("atc_auto"); | ||
| 1647 | - if (conf && conf->arg0() == "off") { | ||
| 1648 | - return false; | 1678 | + conf = conf->get("http_hooks"); |
| 1679 | + if (!conf) { | ||
| 1680 | + return NULL; | ||
| 1649 | } | 1681 | } |
| 1650 | 1682 | ||
| 1651 | - return true; | ||
| 1652 | -} | ||
| 1653 | - | ||
| 1654 | -int SrsConfig::get_time_jitter(string vhost) | ||
| 1655 | -{ | ||
| 1656 | - SrsConfDirective* dvr = get_vhost(vhost); | ||
| 1657 | - | ||
| 1658 | - std::string time_jitter = SRS_CONF_DEFAULT_TIME_JITTER; | ||
| 1659 | - | ||
| 1660 | - if (dvr) { | ||
| 1661 | - SrsConfDirective* conf = dvr->get("time_jitter"); | ||
| 1662 | - | ||
| 1663 | - if (conf) { | ||
| 1664 | - time_jitter = conf->arg0(); | ||
| 1665 | - } | 1683 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1684 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1685 | + return NULL; | ||
| 1666 | } | 1686 | } |
| 1667 | 1687 | ||
| 1668 | - return _srs_time_jitter_string2int(time_jitter); | 1688 | + return conf->get("on_unpublish"); |
| 1669 | } | 1689 | } |
| 1670 | 1690 | ||
| 1671 | -double SrsConfig::get_queue_length(string vhost) | 1691 | +SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) |
| 1672 | { | 1692 | { |
| 1673 | SrsConfDirective* conf = get_vhost(vhost); | 1693 | SrsConfDirective* conf = get_vhost(vhost); |
| 1674 | 1694 | ||
| 1675 | if (!conf) { | 1695 | if (!conf) { |
| 1676 | - return SRS_CONF_DEFAULT_QUEUE_LENGTH; | 1696 | + return NULL; |
| 1677 | } | 1697 | } |
| 1678 | 1698 | ||
| 1679 | - conf = conf->get("queue_length"); | ||
| 1680 | - if (!conf || conf->arg0().empty()) { | ||
| 1681 | - return SRS_CONF_DEFAULT_QUEUE_LENGTH; | 1699 | + conf = conf->get("http_hooks"); |
| 1700 | + if (!conf) { | ||
| 1701 | + return NULL; | ||
| 1682 | } | 1702 | } |
| 1683 | 1703 | ||
| 1684 | - return ::atoi(conf->arg0().c_str()); | ||
| 1685 | -} | ||
| 1686 | - | ||
| 1687 | -SrsConfDirective* SrsConfig::get_forward(string vhost) | ||
| 1688 | -{ | ||
| 1689 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1690 | - | ||
| 1691 | - if (!conf) { | 1704 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1705 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1692 | return NULL; | 1706 | return NULL; |
| 1693 | } | 1707 | } |
| 1694 | 1708 | ||
| 1695 | - return conf->get("forward"); | 1709 | + return conf->get("on_play"); |
| 1696 | } | 1710 | } |
| 1697 | 1711 | ||
| 1698 | -SrsConfDirective* SrsConfig::get_refer(string vhost) | 1712 | +SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost) |
| 1699 | { | 1713 | { |
| 1700 | SrsConfDirective* conf = get_vhost(vhost); | 1714 | SrsConfDirective* conf = get_vhost(vhost); |
| 1701 | 1715 | ||
| @@ -1703,52 +1717,38 @@ SrsConfDirective* SrsConfig::get_refer(string vhost) | @@ -1703,52 +1717,38 @@ SrsConfDirective* SrsConfig::get_refer(string vhost) | ||
| 1703 | return NULL; | 1717 | return NULL; |
| 1704 | } | 1718 | } |
| 1705 | 1719 | ||
| 1706 | - return conf->get("refer"); | ||
| 1707 | -} | ||
| 1708 | - | ||
| 1709 | -SrsConfDirective* SrsConfig::get_refer_play(string vhost) | ||
| 1710 | -{ | ||
| 1711 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1712 | - | 1720 | + conf = conf->get("http_hooks"); |
| 1713 | if (!conf) { | 1721 | if (!conf) { |
| 1714 | return NULL; | 1722 | return NULL; |
| 1715 | } | 1723 | } |
| 1716 | 1724 | ||
| 1717 | - return conf->get("refer_play"); | ||
| 1718 | -} | ||
| 1719 | - | ||
| 1720 | -SrsConfDirective* SrsConfig::get_refer_publish(string vhost) | ||
| 1721 | -{ | ||
| 1722 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1723 | - | ||
| 1724 | - if (!conf) { | 1725 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1726 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1725 | return NULL; | 1727 | return NULL; |
| 1726 | } | 1728 | } |
| 1727 | 1729 | ||
| 1728 | - return conf->get("refer_publish"); | 1730 | + return conf->get("on_stop"); |
| 1729 | } | 1731 | } |
| 1730 | 1732 | ||
| 1731 | -int SrsConfig::get_chunk_size(const string &vhost) | 1733 | +SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) |
| 1732 | { | 1734 | { |
| 1733 | SrsConfDirective* conf = get_vhost(vhost); | 1735 | SrsConfDirective* conf = get_vhost(vhost); |
| 1734 | 1736 | ||
| 1735 | if (!conf) { | 1737 | if (!conf) { |
| 1736 | - return SRS_CONF_DEFAULT_CHUNK_SIZE; | 1738 | + return NULL; |
| 1737 | } | 1739 | } |
| 1738 | 1740 | ||
| 1739 | - conf = conf->get("chunk_size"); | ||
| 1740 | - if (!conf) { | ||
| 1741 | - // vhost does not specify the chunk size, | ||
| 1742 | - // use the global instead. | ||
| 1743 | - conf = root->get("chunk_size"); | 1741 | + conf = conf->get("http_hooks"); |
| 1744 | if (!conf) { | 1742 | if (!conf) { |
| 1745 | - return SRS_CONF_DEFAULT_CHUNK_SIZE; | 1743 | + return NULL; |
| 1746 | } | 1744 | } |
| 1747 | 1745 | ||
| 1748 | - return ::atoi(conf->arg0().c_str()); | 1746 | + SrsConfDirective* enabled = conf->get("enabled"); |
| 1747 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1748 | + return NULL; | ||
| 1749 | } | 1749 | } |
| 1750 | 1750 | ||
| 1751 | - return ::atoi(conf->arg0().c_str()); | 1751 | + return conf->get("on_dvr_hss_reap_flv"); |
| 1752 | } | 1752 | } |
| 1753 | 1753 | ||
| 1754 | bool SrsConfig::get_bw_check_enabled(const string &vhost) | 1754 | bool SrsConfig::get_bw_check_enabled(const string &vhost) |
| @@ -422,81 +422,103 @@ public: | @@ -422,81 +422,103 @@ public: | ||
| 422 | */ | 422 | */ |
| 423 | virtual std::vector<SrsConfDirective*> get_vhosts(); | 423 | virtual std::vector<SrsConfDirective*> get_vhosts(); |
| 424 | /** | 424 | /** |
| 425 | - * | 425 | + * whether vhost is enabled |
| 426 | + * @param vhost, the vhost name. | ||
| 427 | + * @return true when vhost is ok; otherwise, false. | ||
| 426 | */ | 428 | */ |
| 427 | virtual bool get_vhost_enabled(std::string vhost); | 429 | virtual bool get_vhost_enabled(std::string vhost); |
| 428 | /** | 430 | /** |
| 429 | - * | 431 | + * whether vhost is enabled |
| 432 | + * @param vhost, the vhost directive. | ||
| 433 | + * @return true when vhost is ok; otherwise, false. | ||
| 430 | */ | 434 | */ |
| 431 | virtual bool get_vhost_enabled(SrsConfDirective* vhost); | 435 | virtual bool get_vhost_enabled(SrsConfDirective* vhost); |
| 432 | /** | 436 | /** |
| 433 | - * | 437 | + * whether gop_cache is enabled of vhost. |
| 438 | + * gop_cache used to cache last gop, for client to fast startup. | ||
| 439 | + * @return true when gop_cache is ok; otherwise, false. | ||
| 434 | */ | 440 | */ |
| 435 | - virtual SrsConfDirective* get_vhost_on_connect(std::string vhost); | 441 | + virtual bool get_gop_cache(std::string vhost); |
| 436 | /** | 442 | /** |
| 437 | - * | 443 | + * whether atc is enabled of vhost. |
| 444 | + * atc always use encoder timestamp, SRS never adjust the time. | ||
| 445 | + * @return true when atc is ok; otherwise, false. | ||
| 438 | */ | 446 | */ |
| 439 | - virtual SrsConfDirective* get_vhost_on_close(std::string vhost); | 447 | + virtual bool get_atc(std::string vhost); |
| 440 | /** | 448 | /** |
| 441 | - * | 449 | + * whether atc_auto is enabled of vhost. |
| 450 | + * atc_auto used to auto enable atc, when metadata specified the bravo_atc. | ||
| 451 | + * @return true when atc_auto is ok; otherwise, false. | ||
| 442 | */ | 452 | */ |
| 443 | - virtual SrsConfDirective* get_vhost_on_publish(std::string vhost); | 453 | + virtual bool get_atc_auto(std::string vhost); |
| 444 | /** | 454 | /** |
| 445 | - * | 455 | + * get the time_jitter algorithm. |
| 456 | + * @return the time_jitter algorithm, defined in SrsRtmpJitterAlgorithm. | ||
| 446 | */ | 457 | */ |
| 447 | - virtual SrsConfDirective* get_vhost_on_unpublish(std::string vhost); | 458 | + virtual int get_time_jitter(std::string vhost); |
| 448 | /** | 459 | /** |
| 449 | * | 460 | * |
| 450 | */ | 461 | */ |
| 451 | - virtual SrsConfDirective* get_vhost_on_play(std::string vhost); | 462 | + virtual double get_queue_length(std::string vhost); |
| 452 | /** | 463 | /** |
| 453 | * | 464 | * |
| 454 | */ | 465 | */ |
| 455 | - virtual SrsConfDirective* get_vhost_on_stop(std::string vhost); | 466 | + virtual SrsConfDirective* get_refer(std::string vhost); |
| 456 | /** | 467 | /** |
| 457 | * | 468 | * |
| 458 | */ | 469 | */ |
| 459 | - virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost); | 470 | + virtual SrsConfDirective* get_refer_play(std::string vhost); |
| 460 | /** | 471 | /** |
| 461 | * | 472 | * |
| 462 | */ | 473 | */ |
| 463 | - virtual bool get_gop_cache(std::string vhost); | 474 | + virtual SrsConfDirective* get_refer_publish(std::string vhost); |
| 464 | /** | 475 | /** |
| 465 | * | 476 | * |
| 466 | */ | 477 | */ |
| 467 | - virtual bool get_atc(std::string vhost); | 478 | + virtual int get_chunk_size(const std::string& vhost); |
| 479 | +// forward section | ||
| 480 | +public: | ||
| 468 | /** | 481 | /** |
| 469 | * | 482 | * |
| 470 | */ | 483 | */ |
| 471 | - virtual bool get_atc_auto(std::string vhost); | 484 | + virtual SrsConfDirective* get_forward(std::string vhost); |
| 485 | +// http_hooks section | ||
| 486 | +public: | ||
| 472 | /** | 487 | /** |
| 473 | - * | 488 | + * get the on_connect callbacks of vhost. |
| 489 | + * @return the on_connect callback directive, the args is the url to callback. | ||
| 474 | */ | 490 | */ |
| 475 | - virtual int get_time_jitter(std::string vhost); | 491 | + virtual SrsConfDirective* get_vhost_on_connect(std::string vhost); |
| 476 | /** | 492 | /** |
| 477 | - * | 493 | + * get the on_close callbacks of vhost. |
| 494 | + * @return the on_close callback directive, the args is the url to callback. | ||
| 478 | */ | 495 | */ |
| 479 | - virtual double get_queue_length(std::string vhost); | 496 | + virtual SrsConfDirective* get_vhost_on_close(std::string vhost); |
| 480 | /** | 497 | /** |
| 481 | - * | 498 | + * get the on_publish callbacks of vhost. |
| 499 | + * @return the on_publish callback directive, the args is the url to callback. | ||
| 482 | */ | 500 | */ |
| 483 | - virtual SrsConfDirective* get_forward(std::string vhost); | 501 | + virtual SrsConfDirective* get_vhost_on_publish(std::string vhost); |
| 484 | /** | 502 | /** |
| 485 | - * | 503 | + * get the on_unpublish callbacks of vhost. |
| 504 | + * @return the on_unpublish callback directive, the args is the url to callback. | ||
| 486 | */ | 505 | */ |
| 487 | - virtual SrsConfDirective* get_refer(std::string vhost); | 506 | + virtual SrsConfDirective* get_vhost_on_unpublish(std::string vhost); |
| 488 | /** | 507 | /** |
| 489 | - * | 508 | + * get the on_play callbacks of vhost. |
| 509 | + * @return the on_play callback directive, the args is the url to callback. | ||
| 490 | */ | 510 | */ |
| 491 | - virtual SrsConfDirective* get_refer_play(std::string vhost); | 511 | + virtual SrsConfDirective* get_vhost_on_play(std::string vhost); |
| 492 | /** | 512 | /** |
| 493 | - * | 513 | + * get the on_stop callbacks of vhost. |
| 514 | + * @return the on_stop callback directive, the args is the url to callback. | ||
| 494 | */ | 515 | */ |
| 495 | - virtual SrsConfDirective* get_refer_publish(std::string vhost); | 516 | + virtual SrsConfDirective* get_vhost_on_stop(std::string vhost); |
| 496 | /** | 517 | /** |
| 497 | - * | 518 | + * get the on_dvr_hss_reap_flv callbacks of vhost. |
| 519 | + * @return the on_dvr_hss_reap_flv callback directive, the args is the url to callback. | ||
| 498 | */ | 520 | */ |
| 499 | - virtual int get_chunk_size(const std::string& vhost); | 521 | + virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost); |
| 500 | // bwct(bandwidth check tool) section | 522 | // bwct(bandwidth check tool) section |
| 501 | public: | 523 | public: |
| 502 | /** | 524 | /** |
-
请 注册 或 登录 后发表评论