正在显示
2 个修改的文件
包含
210 行增加
和
188 行删除
| @@ -1431,153 +1431,6 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts() | @@ -1431,153 +1431,6 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts() | ||
| 1431 | return vhosts; | 1431 | return vhosts; |
| 1432 | } | 1432 | } |
| 1433 | 1433 | ||
| 1434 | -SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) | ||
| 1435 | -{ | ||
| 1436 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1437 | - | ||
| 1438 | - if (!conf) { | ||
| 1439 | - return NULL; | ||
| 1440 | - } | ||
| 1441 | - | ||
| 1442 | - conf = conf->get("http_hooks"); | ||
| 1443 | - if (!conf) { | ||
| 1444 | - return NULL; | ||
| 1445 | - } | ||
| 1446 | - | ||
| 1447 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1448 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1449 | - return NULL; | ||
| 1450 | - } | ||
| 1451 | - | ||
| 1452 | - return conf->get("on_connect"); | ||
| 1453 | -} | ||
| 1454 | - | ||
| 1455 | -SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost) | ||
| 1456 | -{ | ||
| 1457 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1458 | - | ||
| 1459 | - if (!conf) { | ||
| 1460 | - return NULL; | ||
| 1461 | - } | ||
| 1462 | - | ||
| 1463 | - conf = conf->get("http_hooks"); | ||
| 1464 | - if (!conf) { | ||
| 1465 | - return NULL; | ||
| 1466 | - } | ||
| 1467 | - | ||
| 1468 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1469 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1470 | - return NULL; | ||
| 1471 | - } | ||
| 1472 | - | ||
| 1473 | - return conf->get("on_close"); | ||
| 1474 | -} | ||
| 1475 | - | ||
| 1476 | -SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost) | ||
| 1477 | -{ | ||
| 1478 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1479 | - | ||
| 1480 | - if (!conf) { | ||
| 1481 | - return NULL; | ||
| 1482 | - } | ||
| 1483 | - | ||
| 1484 | - conf = conf->get("http_hooks"); | ||
| 1485 | - if (!conf) { | ||
| 1486 | - return NULL; | ||
| 1487 | - } | ||
| 1488 | - | ||
| 1489 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1490 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1491 | - return NULL; | ||
| 1492 | - } | ||
| 1493 | - | ||
| 1494 | - return conf->get("on_publish"); | ||
| 1495 | -} | ||
| 1496 | - | ||
| 1497 | -SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost) | ||
| 1498 | -{ | ||
| 1499 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1500 | - | ||
| 1501 | - if (!conf) { | ||
| 1502 | - return NULL; | ||
| 1503 | - } | ||
| 1504 | - | ||
| 1505 | - conf = conf->get("http_hooks"); | ||
| 1506 | - if (!conf) { | ||
| 1507 | - return NULL; | ||
| 1508 | - } | ||
| 1509 | - | ||
| 1510 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1511 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1512 | - return NULL; | ||
| 1513 | - } | ||
| 1514 | - | ||
| 1515 | - return conf->get("on_unpublish"); | ||
| 1516 | -} | ||
| 1517 | - | ||
| 1518 | -SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) | ||
| 1519 | -{ | ||
| 1520 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1521 | - | ||
| 1522 | - if (!conf) { | ||
| 1523 | - return NULL; | ||
| 1524 | - } | ||
| 1525 | - | ||
| 1526 | - conf = conf->get("http_hooks"); | ||
| 1527 | - if (!conf) { | ||
| 1528 | - return NULL; | ||
| 1529 | - } | ||
| 1530 | - | ||
| 1531 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1532 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1533 | - return NULL; | ||
| 1534 | - } | ||
| 1535 | - | ||
| 1536 | - return conf->get("on_play"); | ||
| 1537 | -} | ||
| 1538 | - | ||
| 1539 | -SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost) | ||
| 1540 | -{ | ||
| 1541 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1542 | - | ||
| 1543 | - if (!conf) { | ||
| 1544 | - return NULL; | ||
| 1545 | - } | ||
| 1546 | - | ||
| 1547 | - conf = conf->get("http_hooks"); | ||
| 1548 | - if (!conf) { | ||
| 1549 | - return NULL; | ||
| 1550 | - } | ||
| 1551 | - | ||
| 1552 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1553 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1554 | - return NULL; | ||
| 1555 | - } | ||
| 1556 | - | ||
| 1557 | - return conf->get("on_stop"); | ||
| 1558 | -} | ||
| 1559 | - | ||
| 1560 | -SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) | ||
| 1561 | -{ | ||
| 1562 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1563 | - | ||
| 1564 | - if (!conf) { | ||
| 1565 | - return NULL; | ||
| 1566 | - } | ||
| 1567 | - | ||
| 1568 | - conf = conf->get("http_hooks"); | ||
| 1569 | - if (!conf) { | ||
| 1570 | - return NULL; | ||
| 1571 | - } | ||
| 1572 | - | ||
| 1573 | - SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1574 | - if (!enabled || enabled->arg0() != "on") { | ||
| 1575 | - return NULL; | ||
| 1576 | - } | ||
| 1577 | - | ||
| 1578 | - return conf->get("on_dvr_hss_reap_flv"); | ||
| 1579 | -} | ||
| 1580 | - | ||
| 1581 | bool SrsConfig::get_vhost_enabled(string vhost) | 1434 | bool SrsConfig::get_vhost_enabled(string vhost) |
| 1582 | { | 1435 | { |
| 1583 | SrsConfDirective* vhost_conf = get_vhost(vhost); | 1436 | SrsConfDirective* vhost_conf = get_vhost(vhost); |
| @@ -1684,17 +1537,6 @@ double SrsConfig::get_queue_length(string vhost) | @@ -1684,17 +1537,6 @@ double SrsConfig::get_queue_length(string vhost) | ||
| 1684 | return ::atoi(conf->arg0().c_str()); | 1537 | return ::atoi(conf->arg0().c_str()); |
| 1685 | } | 1538 | } |
| 1686 | 1539 | ||
| 1687 | -SrsConfDirective* SrsConfig::get_forward(string vhost) | ||
| 1688 | -{ | ||
| 1689 | - SrsConfDirective* conf = get_vhost(vhost); | ||
| 1690 | - | ||
| 1691 | - if (!conf) { | ||
| 1692 | - return NULL; | ||
| 1693 | - } | ||
| 1694 | - | ||
| 1695 | - return conf->get("forward"); | ||
| 1696 | -} | ||
| 1697 | - | ||
| 1698 | SrsConfDirective* SrsConfig::get_refer(string vhost) | 1540 | SrsConfDirective* SrsConfig::get_refer(string vhost) |
| 1699 | { | 1541 | { |
| 1700 | SrsConfDirective* conf = get_vhost(vhost); | 1542 | SrsConfDirective* conf = get_vhost(vhost); |
| @@ -1751,6 +1593,164 @@ int SrsConfig::get_chunk_size(const string &vhost) | @@ -1751,6 +1593,164 @@ int SrsConfig::get_chunk_size(const string &vhost) | ||
| 1751 | return ::atoi(conf->arg0().c_str()); | 1593 | return ::atoi(conf->arg0().c_str()); |
| 1752 | } | 1594 | } |
| 1753 | 1595 | ||
| 1596 | +SrsConfDirective* SrsConfig::get_forward(string vhost) | ||
| 1597 | +{ | ||
| 1598 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1599 | + | ||
| 1600 | + if (!conf) { | ||
| 1601 | + return NULL; | ||
| 1602 | + } | ||
| 1603 | + | ||
| 1604 | + return conf->get("forward"); | ||
| 1605 | +} | ||
| 1606 | + | ||
| 1607 | +SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost) | ||
| 1608 | +{ | ||
| 1609 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1610 | + | ||
| 1611 | + if (!conf) { | ||
| 1612 | + return NULL; | ||
| 1613 | + } | ||
| 1614 | + | ||
| 1615 | + conf = conf->get("http_hooks"); | ||
| 1616 | + if (!conf) { | ||
| 1617 | + return NULL; | ||
| 1618 | + } | ||
| 1619 | + | ||
| 1620 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1621 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1622 | + return NULL; | ||
| 1623 | + } | ||
| 1624 | + | ||
| 1625 | + return conf->get("on_connect"); | ||
| 1626 | +} | ||
| 1627 | + | ||
| 1628 | +SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost) | ||
| 1629 | +{ | ||
| 1630 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1631 | + | ||
| 1632 | + if (!conf) { | ||
| 1633 | + return NULL; | ||
| 1634 | + } | ||
| 1635 | + | ||
| 1636 | + conf = conf->get("http_hooks"); | ||
| 1637 | + if (!conf) { | ||
| 1638 | + return NULL; | ||
| 1639 | + } | ||
| 1640 | + | ||
| 1641 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1642 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1643 | + return NULL; | ||
| 1644 | + } | ||
| 1645 | + | ||
| 1646 | + return conf->get("on_close"); | ||
| 1647 | +} | ||
| 1648 | + | ||
| 1649 | +SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost) | ||
| 1650 | +{ | ||
| 1651 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1652 | + | ||
| 1653 | + if (!conf) { | ||
| 1654 | + return NULL; | ||
| 1655 | + } | ||
| 1656 | + | ||
| 1657 | + conf = conf->get("http_hooks"); | ||
| 1658 | + if (!conf) { | ||
| 1659 | + return NULL; | ||
| 1660 | + } | ||
| 1661 | + | ||
| 1662 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1663 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1664 | + return NULL; | ||
| 1665 | + } | ||
| 1666 | + | ||
| 1667 | + return conf->get("on_publish"); | ||
| 1668 | +} | ||
| 1669 | + | ||
| 1670 | +SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost) | ||
| 1671 | +{ | ||
| 1672 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1673 | + | ||
| 1674 | + if (!conf) { | ||
| 1675 | + return NULL; | ||
| 1676 | + } | ||
| 1677 | + | ||
| 1678 | + conf = conf->get("http_hooks"); | ||
| 1679 | + if (!conf) { | ||
| 1680 | + return NULL; | ||
| 1681 | + } | ||
| 1682 | + | ||
| 1683 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1684 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1685 | + return NULL; | ||
| 1686 | + } | ||
| 1687 | + | ||
| 1688 | + return conf->get("on_unpublish"); | ||
| 1689 | +} | ||
| 1690 | + | ||
| 1691 | +SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost) | ||
| 1692 | +{ | ||
| 1693 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1694 | + | ||
| 1695 | + if (!conf) { | ||
| 1696 | + return NULL; | ||
| 1697 | + } | ||
| 1698 | + | ||
| 1699 | + conf = conf->get("http_hooks"); | ||
| 1700 | + if (!conf) { | ||
| 1701 | + return NULL; | ||
| 1702 | + } | ||
| 1703 | + | ||
| 1704 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1705 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1706 | + return NULL; | ||
| 1707 | + } | ||
| 1708 | + | ||
| 1709 | + return conf->get("on_play"); | ||
| 1710 | +} | ||
| 1711 | + | ||
| 1712 | +SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost) | ||
| 1713 | +{ | ||
| 1714 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1715 | + | ||
| 1716 | + if (!conf) { | ||
| 1717 | + return NULL; | ||
| 1718 | + } | ||
| 1719 | + | ||
| 1720 | + conf = conf->get("http_hooks"); | ||
| 1721 | + if (!conf) { | ||
| 1722 | + return NULL; | ||
| 1723 | + } | ||
| 1724 | + | ||
| 1725 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1726 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1727 | + return NULL; | ||
| 1728 | + } | ||
| 1729 | + | ||
| 1730 | + return conf->get("on_stop"); | ||
| 1731 | +} | ||
| 1732 | + | ||
| 1733 | +SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost) | ||
| 1734 | +{ | ||
| 1735 | + SrsConfDirective* conf = get_vhost(vhost); | ||
| 1736 | + | ||
| 1737 | + if (!conf) { | ||
| 1738 | + return NULL; | ||
| 1739 | + } | ||
| 1740 | + | ||
| 1741 | + conf = conf->get("http_hooks"); | ||
| 1742 | + if (!conf) { | ||
| 1743 | + return NULL; | ||
| 1744 | + } | ||
| 1745 | + | ||
| 1746 | + SrsConfDirective* enabled = conf->get("enabled"); | ||
| 1747 | + if (!enabled || enabled->arg0() != "on") { | ||
| 1748 | + return NULL; | ||
| 1749 | + } | ||
| 1750 | + | ||
| 1751 | + return conf->get("on_dvr_hss_reap_flv"); | ||
| 1752 | +} | ||
| 1753 | + | ||
| 1754 | bool SrsConfig::get_bw_check_enabled(const string &vhost) | 1754 | bool SrsConfig::get_bw_check_enabled(const string &vhost) |
| 1755 | { | 1755 | { |
| 1756 | SrsConfDirective* conf = get_vhost(vhost); | 1756 | SrsConfDirective* conf = get_vhost(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 | /** |
-
请 注册 或 登录 后发表评论