mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add heatbeat url, add stream for api-server
This commit is contained in:
parent
98b564ce64
commit
7c804277b2
4 changed files with 39 additions and 3 deletions
|
@ -41,6 +41,14 @@ max_connections 1000;
|
||||||
# @remark: donot support reload.
|
# @remark: donot support reload.
|
||||||
# default: on
|
# default: on
|
||||||
daemon on;
|
daemon on;
|
||||||
|
# heartbeat to api server
|
||||||
|
# when startup, srs will heartbeat to this api.
|
||||||
|
# @remark: must be a restful http api url, where SRS will POST with following data:
|
||||||
|
# {
|
||||||
|
# "device_id": "my-srs-device",
|
||||||
|
# "ip": "192.168.1.100"
|
||||||
|
# }
|
||||||
|
heartbeat http://127.0.0.1:8085/api/v1/servers;
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
# HTTP sections
|
# HTTP sections
|
||||||
|
|
|
@ -428,8 +428,8 @@ class RESTServers(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __refresh_nodes(self):
|
def __refresh_nodes(self):
|
||||||
has_dead_node = False
|
|
||||||
while len(self.__nodes) > 0:
|
while len(self.__nodes) > 0:
|
||||||
|
has_dead_node = False
|
||||||
for node in self.__nodes:
|
for node in self.__nodes:
|
||||||
if node.dead():
|
if node.dead():
|
||||||
self.__nodes.remove(node)
|
self.__nodes.remove(node)
|
||||||
|
@ -639,6 +639,22 @@ class RESTServers(object):
|
||||||
"stream6": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream6",
|
"stream6": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream6",
|
||||||
"stream7": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream7"
|
"stream7": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-bk&stream=live/stream7"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"meiyi-dev1": {
|
||||||
|
"rtmp": {
|
||||||
|
"livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=rtmp&device_id=chnvideo-meiyi-cubieboard-dev1&stream=live/livestream"
|
||||||
|
},
|
||||||
|
"hls": {
|
||||||
|
"livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-dev1&stream=live/livestream"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meiyi-dev2": {
|
||||||
|
"rtmp": {
|
||||||
|
"livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=rtmp&device_id=chnvideo-meiyi-cubieboard-dev2&stream=live/livestream"
|
||||||
|
},
|
||||||
|
"hls": {
|
||||||
|
"livesteam": "http://demo.chnvideo.com:8085/api/v1/servers?id=ingest&action=hls&device_id=chnvideo-meiyi-cubieboard-dev2&stream=live/livestream"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -732,8 +748,8 @@ class RESTNodes(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __refresh_nodes(self):
|
def __refresh_nodes(self):
|
||||||
has_dead_node = False
|
|
||||||
while len(self.__nodes) > 0:
|
while len(self.__nodes) > 0:
|
||||||
|
has_dead_node = False
|
||||||
for node in self.__nodes:
|
for node in self.__nodes:
|
||||||
if node.dead():
|
if node.dead():
|
||||||
self.__nodes.remove(node)
|
self.__nodes.remove(node)
|
||||||
|
|
|
@ -509,7 +509,7 @@ int SrsConfig::reload()
|
||||||
//
|
//
|
||||||
// always support reload without additional code:
|
// always support reload without additional code:
|
||||||
// chunk_size, ff_log_dir, max_connections,
|
// chunk_size, ff_log_dir, max_connections,
|
||||||
// bandcheck, http_hooks
|
// bandcheck, http_hooks, heartbeat
|
||||||
|
|
||||||
// merge config: listen
|
// merge config: listen
|
||||||
if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
|
if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
|
||||||
|
@ -1422,6 +1422,17 @@ string SrsConfig::get_pid_file()
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SrsConfig::get_heartbeat_url()
|
||||||
|
{
|
||||||
|
SrsConfDirective* conf = root->get("heartbeat");
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return conf->arg0();
|
||||||
|
}
|
||||||
|
|
||||||
int SrsConfig::get_pithy_print_publish()
|
int SrsConfig::get_pithy_print_publish()
|
||||||
{
|
{
|
||||||
SrsConfDirective* pithy = root->get("pithy_print");
|
SrsConfDirective* pithy = root->get("pithy_print");
|
||||||
|
|
|
@ -173,6 +173,7 @@ public:
|
||||||
virtual int get_max_connections();
|
virtual int get_max_connections();
|
||||||
virtual SrsConfDirective* get_listen();
|
virtual SrsConfDirective* get_listen();
|
||||||
virtual std::string get_pid_file();
|
virtual std::string get_pid_file();
|
||||||
|
virtual std::string get_heartbeat_url();
|
||||||
virtual int get_pithy_print_publish();
|
virtual int get_pithy_print_publish();
|
||||||
virtual int get_pithy_print_forwarder();
|
virtual int get_pithy_print_forwarder();
|
||||||
virtual int get_pithy_print_encoder();
|
virtual int get_pithy_print_encoder();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue