正在显示
4 个修改的文件
包含
39 行增加
和
3 行删除
| @@ -41,6 +41,14 @@ max_connections 1000; | @@ -41,6 +41,14 @@ max_connections 1000; | ||
| 41 | # @remark: donot support reload. | 41 | # @remark: donot support reload. |
| 42 | # default: on | 42 | # default: on |
| 43 | daemon on; | 43 | daemon on; |
| 44 | +# heartbeat to api server | ||
| 45 | +# when startup, srs will heartbeat to this api. | ||
| 46 | +# @remark: must be a restful http api url, where SRS will POST with following data: | ||
| 47 | +# { | ||
| 48 | +# "device_id": "my-srs-device", | ||
| 49 | +# "ip": "192.168.1.100" | ||
| 50 | +# } | ||
| 51 | +heartbeat http://127.0.0.1:8085/api/v1/servers; | ||
| 44 | 52 | ||
| 45 | ############################################################################################# | 53 | ############################################################################################# |
| 46 | # HTTP sections | 54 | # HTTP sections |
| @@ -428,8 +428,8 @@ class RESTServers(object): | @@ -428,8 +428,8 @@ class RESTServers(object): | ||
| 428 | return None | 428 | return None |
| 429 | 429 | ||
| 430 | def __refresh_nodes(self): | 430 | def __refresh_nodes(self): |
| 431 | - has_dead_node = False | ||
| 432 | while len(self.__nodes) > 0: | 431 | while len(self.__nodes) > 0: |
| 432 | + has_dead_node = False | ||
| 433 | for node in self.__nodes: | 433 | for node in self.__nodes: |
| 434 | if node.dead(): | 434 | if node.dead(): |
| 435 | self.__nodes.remove(node) | 435 | self.__nodes.remove(node) |
| @@ -639,6 +639,22 @@ class RESTServers(object): | @@ -639,6 +639,22 @@ class RESTServers(object): | ||
| 639 | "stream6": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream6", | 639 | "stream6": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream6", |
| 640 | "stream7": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream7" | 640 | "stream7": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream7" |
| 641 | } | 641 | } |
| 642 | + }, | ||
| 643 | + "meiyi-dev1": { | ||
| 644 | + "rtmp": { | ||
| 645 | + "livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=rtmp&device_id=chnvideo-meiyi-cubieboard-dev1&stream=live/livestream" | ||
| 646 | + }, | ||
| 647 | + "hls": { | ||
| 648 | + "livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-dev1&stream=live/livestream" | ||
| 649 | + } | ||
| 650 | + }, | ||
| 651 | + "meiyi-dev2": { | ||
| 652 | + "rtmp": { | ||
| 653 | + "livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=rtmp&device_id=chnvideo-meiyi-cubieboard-dev2&stream=live/livestream" | ||
| 654 | + }, | ||
| 655 | + "hls": { | ||
| 656 | + "livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-dev2&stream=live/livestream" | ||
| 657 | + } | ||
| 642 | } | 658 | } |
| 643 | } | 659 | } |
| 644 | } | 660 | } |
| @@ -732,8 +748,8 @@ class RESTNodes(object): | @@ -732,8 +748,8 @@ class RESTNodes(object): | ||
| 732 | return None | 748 | return None |
| 733 | 749 | ||
| 734 | def __refresh_nodes(self): | 750 | def __refresh_nodes(self): |
| 735 | - has_dead_node = False | ||
| 736 | while len(self.__nodes) > 0: | 751 | while len(self.__nodes) > 0: |
| 752 | + has_dead_node = False | ||
| 737 | for node in self.__nodes: | 753 | for node in self.__nodes: |
| 738 | if node.dead(): | 754 | if node.dead(): |
| 739 | self.__nodes.remove(node) | 755 | self.__nodes.remove(node) |
| @@ -509,7 +509,7 @@ int SrsConfig::reload() | @@ -509,7 +509,7 @@ int SrsConfig::reload() | ||
| 509 | // | 509 | // |
| 510 | // always support reload without additional code: | 510 | // always support reload without additional code: |
| 511 | // chunk_size, ff_log_dir, max_connections, | 511 | // chunk_size, ff_log_dir, max_connections, |
| 512 | - // bandcheck, http_hooks | 512 | + // bandcheck, http_hooks, heartbeat |
| 513 | 513 | ||
| 514 | // merge config: listen | 514 | // merge config: listen |
| 515 | if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { | 515 | if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { |
| @@ -1422,6 +1422,17 @@ string SrsConfig::get_pid_file() | @@ -1422,6 +1422,17 @@ string SrsConfig::get_pid_file() | ||
| 1422 | return conf->arg0(); | 1422 | return conf->arg0(); |
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | +string SrsConfig::get_heartbeat_url() | ||
| 1426 | +{ | ||
| 1427 | + SrsConfDirective* conf = root->get("heartbeat"); | ||
| 1428 | + | ||
| 1429 | + if (!conf) { | ||
| 1430 | + return ""; | ||
| 1431 | + } | ||
| 1432 | + | ||
| 1433 | + return conf->arg0(); | ||
| 1434 | +} | ||
| 1435 | + | ||
| 1425 | int SrsConfig::get_pithy_print_publish() | 1436 | int SrsConfig::get_pithy_print_publish() |
| 1426 | { | 1437 | { |
| 1427 | SrsConfDirective* pithy = root->get("pithy_print"); | 1438 | SrsConfDirective* pithy = root->get("pithy_print"); |
| @@ -173,6 +173,7 @@ public: | @@ -173,6 +173,7 @@ public: | ||
| 173 | virtual int get_max_connections(); | 173 | virtual int get_max_connections(); |
| 174 | virtual SrsConfDirective* get_listen(); | 174 | virtual SrsConfDirective* get_listen(); |
| 175 | virtual std::string get_pid_file(); | 175 | virtual std::string get_pid_file(); |
| 176 | + virtual std::string get_heartbeat_url(); | ||
| 176 | virtual int get_pithy_print_publish(); | 177 | virtual int get_pithy_print_publish(); |
| 177 | virtual int get_pithy_print_forwarder(); | 178 | virtual int get_pithy_print_forwarder(); |
| 178 | virtual int get_pithy_print_encoder(); | 179 | virtual int get_pithy_print_encoder(); |
-
请 注册 或 登录 后发表评论