From 99bffea328e8ad66a5cc3a7e53b91cd7ea555a5e Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 9 Feb 2017 14:29:57 +0800 Subject: [PATCH] fix #503, disable utilities when reload a source. 2.0.233 --- README.md | 2 ++ trunk/src/app/srs_app_source.cpp | 31 ++++++++++++++++++++++++++++++- trunk/src/core/srs_core.hpp | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 265b51595..b4898a74b 100755 --- a/README.md +++ b/README.md @@ -346,6 +346,7 @@ Remark: ## History +* 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 * v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines. @@ -1285,6 +1286,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 [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 1771bbb28..6657b0adc 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1227,6 +1227,12 @@ int SrsSource::on_reload_vhost_forward(string vhost) // forwarders destroy_forwarders(); + + // Don't start forwarders when source is not active. + if (_can_publish) { + return ret; + } + if ((ret = create_forwarders()) != ERROR_SUCCESS) { srs_error("create forwarders failed. ret=%d", ret); return ret; @@ -1247,6 +1253,12 @@ int SrsSource::on_reload_vhost_hls(string vhost) #ifdef SRS_AUTO_HLS hls->on_unpublish(); + + // Don't start forwarders when source is not active. + if (_can_publish) { + return ret; + } + if ((ret = hls->on_publish(_req, true)) != ERROR_SUCCESS) { srs_error("hls publish failed. ret=%d", ret); return ret; @@ -1267,6 +1279,12 @@ int SrsSource::on_reload_vhost_hds(string vhost) #ifdef SRS_AUTO_HDS hds->on_unpublish(); + + // Don't start forwarders when source is not active. + if (_can_publish) { + return ret; + } + if ((ret = hds->on_publish(_req)) != ERROR_SUCCESS) { srs_error("hds publish failed. ret=%d", ret); return ret; @@ -1288,7 +1306,12 @@ int SrsSource::on_reload_vhost_dvr(string vhost) #ifdef SRS_AUTO_DVR // cleanup dvr dvr->on_unpublish(); - + + // Don't start forwarders when source is not active. + if (_can_publish) { + return ret; + } + // reinitialize the dvr, update plan. if ((ret = dvr->initialize(this, _req)) != ERROR_SUCCESS) { return ret; @@ -1316,6 +1339,12 @@ int SrsSource::on_reload_vhost_transcode(string vhost) #ifdef SRS_AUTO_TRANSCODE encoder->on_unpublish(); + + // Don't start forwarders when source is not active. + if (_can_publish) { + return ret; + } + if ((ret = encoder->on_publish(_req)) != ERROR_SUCCESS) { srs_error("start encoder failed. ret=%d", ret); return ret; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 77ee2d257..7b9c6f907 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 232 +#define VERSION_REVISION 233 // generated by configure, only macros. #include