merge from srs2, fix #503

pull/763/head
winlin 8 years ago
commit 5fec59ace2

@ -209,6 +209,7 @@ Please select your language:
### V2 changes
* v2.0, 2017-02-09, fix [#503][bug #503] disable utilities when reload a source. 2.0.233
* v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232
* v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231
* <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong>
@ -1374,6 +1375,7 @@ Winlin
[bug #749]: https://github.com/ossrs/srs/issues/749
[bug #750]: https://github.com/ossrs/srs/issues/750
[bug #752]: https://github.com/ossrs/srs/issues/752
[bug #503]: https://github.com/ossrs/srs/issues/503
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
[bug #735]: https://github.com/ossrs/srs/issues/735

@ -3,6 +3,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}

@ -5,6 +5,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;

@ -5,7 +5,8 @@
listen 1935;
max_connections 1000;
pid objs/edge.pid;
srs_log_file ./objs/edge.log;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;

@ -4,6 +4,8 @@
listen 1935
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
transcode {
enabled on;

@ -5,8 +5,8 @@
listen 1935;
max_connections 1000;
pid ./objs/srs.master.pid;
srs_log_tank file;
srs_log_file ./objs/srs.master.log;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
forward {
enabled on;

@ -5,7 +5,7 @@
listen 19350;
max_connections 1000;
pid ./objs/srs.slave.pid;
srs_log_tank file;
srs_log_file ./objs/srs.slave.log;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}

@ -4,10 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
srs_log_level trace;
vhost __defaultVhost__ {
hds {

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
hls {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -5,7 +5,8 @@
listen 19351;
max_connections 1000;
pid objs/srs.flv.19351.pid;
srs_log_file objs/srs.flv.19351.log;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8081;

@ -5,7 +5,8 @@
listen 19352;
max_connections 1000;
pid objs/srs.flv.19352.pid;
srs_log_file objs/srs.flv.19352.log;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8082;

@ -3,6 +3,8 @@
listen 1935
max_connections 1000;
daemon off;
srs_log_tank console;
heartbeat {
enabled on;
interval 9.3;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -3,8 +3,8 @@
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./objs/srs.log;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
http_hooks {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -3,6 +3,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
ingest livestream {
enabled on;

@ -4,7 +4,7 @@
listen 19350;
max_connections 1000;
pid objs/origin.pid;
srs_log_file ./objs/origin.log;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;

@ -5,6 +5,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
stream_caster {
enabled on;
caster mpegts_over_udp;

@ -5,6 +5,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
stream_caster {
enabled on;
caster rtsp;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
tcp_nodelay on
min_latency on;

@ -4,5 +4,7 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
security {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
hls {
enabled on;

@ -4,6 +4,8 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}
vhost source.srs.com {

@ -840,6 +840,7 @@ SrsOriginHub::SrsOriginHub(SrsSource* s)
{
source = s;
req = NULL;
is_active = false;
#ifdef SRS_AUTO_HLS
hls = new SrsHls();
@ -1141,11 +1142,15 @@ int SrsOriginHub::on_publish()
return ret;
}
is_active = true;
return ret;
}
void SrsOriginHub::on_unpublish()
{
is_active = false;
// destroy all forwarders
destroy_forwarders();
@ -1261,6 +1266,12 @@ int SrsOriginHub::on_reload_vhost_forward(string vhost)
// forwarders
destroy_forwarders();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
if ((ret = create_forwarders()) != ERROR_SUCCESS) {
srs_error("create forwarders failed. ret=%d", ret);
return ret;
@ -1283,6 +1294,12 @@ int SrsOriginHub::on_reload_vhost_hls(string vhost)
#ifdef SRS_AUTO_HLS
hls->on_unpublish();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
if ((ret = hls->on_publish(true)) != ERROR_SUCCESS) {
srs_error("hls publish failed. ret=%d", ret);
return ret;
@ -1305,6 +1322,12 @@ int SrsOriginHub::on_reload_vhost_hds(string vhost)
#ifdef SRS_AUTO_HDS
hds->on_unpublish();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
if ((ret = hds->on_publish(req)) != ERROR_SUCCESS) {
srs_error("hds publish failed. ret=%d", ret);
return ret;
@ -1329,6 +1352,11 @@ int SrsOriginHub::on_reload_vhost_dvr(string vhost)
// cleanup dvr
dvr->on_unpublish();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
// reinitialize the dvr, update plan.
if ((ret = dvr->initialize(this, req)) != ERROR_SUCCESS) {
return ret;
@ -1358,6 +1386,12 @@ int SrsOriginHub::on_reload_vhost_transcode(string vhost)
#ifdef SRS_AUTO_TRANSCODE
encoder->on_unpublish();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) {
srs_error("start encoder failed. ret=%d", ret);
return ret;
@ -1379,6 +1413,12 @@ int SrsOriginHub::on_reload_vhost_exec(string vhost)
// TODO: FIXME: maybe should ignore when publish already stopped?
ng_exec->on_unpublish();
// Don't start forwarders when source is not active.
if (!is_active) {
return ret;
}
if ((ret = ng_exec->on_publish(req)) != ERROR_SUCCESS) {
srs_error("start exec failed. ret=%d", ret);
return ret;

@ -421,6 +421,8 @@ class SrsOriginHub : public ISrsReloadHandler
private:
SrsSource* source;
SrsRequest* req;
// Whether the stream hub is active, or stream is publishing.
bool is_active;
private:
// hls handler.
#ifdef SRS_AUTO_HLS

Loading…
Cancel
Save