add heatbeat url, add stream for api-server

pull/133/head
winlin 11 years ago
parent 98b564ce64
commit 7c804277b2

@ -41,6 +41,14 @@ max_connections 1000;
# @remark: donot support reload.
# default: 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

@ -428,8 +428,8 @@ class RESTServers(object):
return None
def __refresh_nodes(self):
has_dead_node = False
while len(self.__nodes) > 0:
has_dead_node = False
for node in self.__nodes:
if node.dead():
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",
"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
def __refresh_nodes(self):
has_dead_node = False
while len(self.__nodes) > 0:
has_dead_node = False
for node in self.__nodes:
if node.dead():
self.__nodes.remove(node)

@ -509,7 +509,7 @@ int SrsConfig::reload()
//
// always support reload without additional code:
// chunk_size, ff_log_dir, max_connections,
// bandcheck, http_hooks
// bandcheck, http_hooks, heartbeat
// merge config: listen
if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
@ -1422,6 +1422,17 @@ string SrsConfig::get_pid_file()
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()
{
SrsConfDirective* pithy = root->get("pithy_print");

@ -173,6 +173,7 @@ public:
virtual int get_max_connections();
virtual SrsConfDirective* get_listen();
virtual std::string get_pid_file();
virtual std::string get_heartbeat_url();
virtual int get_pithy_print_publish();
virtual int get_pithy_print_forwarder();
virtual int get_pithy_print_encoder();

Loading…
Cancel
Save