From 2fa151726b953f779838e2f097a0fcca87fb3b82 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Feb 2020 12:15:44 +0800 Subject: [PATCH 1/5] For #1592, rename ff_log_dir. --- trunk/src/app/srs_app_config.cpp | 6 +++--- trunk/src/app/srs_app_config.hpp | 4 ++-- trunk/src/app/srs_app_encoder.cpp | 4 ++-- trunk/src/app/srs_app_ingest.cpp | 4 ++-- trunk/src/utest/srs_utest_config.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index b75d0ac81..d845e7fa5 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -5764,13 +5764,13 @@ string SrsConfig::get_log_file() return conf->arg0(); } -bool SrsConfig::get_ffmpeg_log_enabled() +bool SrsConfig::get_ff_log_enabled() { - string log = get_ffmpeg_log_dir(); + string log = get_ff_log_dir(); return log != SRS_CONSTS_NULL_FILE; } -string SrsConfig::get_ffmpeg_log_dir() +string SrsConfig::get_ff_log_dir() { static string DEFAULT = "./objs"; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 03ed3e858..9582b1235 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -779,10 +779,10 @@ public: // Get the log file path. virtual std::string get_log_file(); // Whether ffmpeg log enabled - virtual bool get_ffmpeg_log_enabled(); + virtual bool get_ff_log_enabled(); // The ffmpeg log dir. // @remark, /dev/null to disable it. - virtual std::string get_ffmpeg_log_dir(); + virtual std::string get_ff_log_dir(); // The MPEG-DASH section. private: virtual SrsConfDirective* get_dash(std::string vhost); diff --git a/trunk/src/app/srs_app_encoder.cpp b/trunk/src/app/srs_app_encoder.cpp index be3bb0263..346bd2715 100644 --- a/trunk/src/app/srs_app_encoder.cpp +++ b/trunk/src/app/srs_app_encoder.cpp @@ -285,8 +285,8 @@ srs_error_t SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, Sr std::string log_file = SRS_CONSTS_NULL_FILE; // disabled // write ffmpeg info to log file. - if (_srs_config->get_ffmpeg_log_enabled()) { - log_file = _srs_config->get_ffmpeg_log_dir(); + if (_srs_config->get_ff_log_enabled()) { + log_file = _srs_config->get_ff_log_dir(); log_file += "/"; log_file += "ffmpeg-encoder"; log_file += "-"; diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index 453c48c6e..b9cbb30da 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -397,8 +397,8 @@ srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* std::string log_file = SRS_CONSTS_NULL_FILE; // disabled // write ffmpeg info to log file. - if (_srs_config->get_ffmpeg_log_enabled()) { - log_file = _srs_config->get_ffmpeg_log_dir(); + if (_srs_config->get_ff_log_enabled()) { + log_file = _srs_config->get_ff_log_dir(); log_file += "/"; log_file += "ffmpeg-ingest"; log_file += "-"; diff --git a/trunk/src/utest/srs_utest_config.cpp b/trunk/src/utest/srs_utest_config.cpp index 2b8d90e75..d8538cb8d 100644 --- a/trunk/src/utest/srs_utest_config.cpp +++ b/trunk/src/utest/srs_utest_config.cpp @@ -3507,8 +3507,8 @@ VOID TEST(ConfigMainTest, CheckVhostConfig5) EXPECT_TRUE(conf.get_log_tank_file()); EXPECT_STREQ("xxx2", conf.get_log_level().c_str()); EXPECT_STREQ("xxx3", conf.get_log_file().c_str()); - EXPECT_STREQ("xxx4", conf.get_ffmpeg_log_dir().c_str()); - EXPECT_TRUE(conf.get_ffmpeg_log_enabled()); + EXPECT_STREQ("xxx4", conf.get_ff_log_dir().c_str()); + EXPECT_TRUE(conf.get_ff_log_enabled()); } if (true) { From c50c51889af59fe887b09f75e210abe584b9de13 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Feb 2020 12:32:15 +0800 Subject: [PATCH 2/5] For #1592, support ff_log_level and default to warning --- trunk/conf/full.conf | 7 ++++++- trunk/src/app/srs_app_config.cpp | 13 +++++++++++++ trunk/src/app/srs_app_config.hpp | 2 ++ trunk/src/app/srs_app_ffmpeg.cpp | 11 +++++++---- trunk/src/app/srs_app_ffmpeg.hpp | 4 ++-- trunk/src/app/srs_app_ingest.cpp | 12 +++++++++--- trunk/src/utest/srs_utest_config.cpp | 8 +++++++- 7 files changed, 46 insertions(+), 11 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 890b1c000..9c7f720cd 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -19,11 +19,16 @@ pid ./objs/srs.pid; # performance about 10%. # default: 60000 chunk_size 60000; -# the logs dir. +# the log dir for FFMPEG. # if enabled ffmpeg, each transcoding stream will create a log file. # /dev/null to disable the log. # default: ./objs ff_log_dir ./objs; +# the log level for FFMPEG. +# info warning error fatal panic quiet +# trace debug verbose +# default: warning +ff_log_level warning; # the log tank, console or file. # if console, print log to console. # if file, write log to file. requires srs_log_file if log to file. diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index d845e7fa5..ebb877f44 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3487,6 +3487,7 @@ srs_error_t SrsConfig::check_normal_config() && n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print_ms" && n != "http_server" && n != "stream_caster" && n != "utc_time" && n != "work_dir" && n != "asprocess" + && n != "ff_log_level" ) { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str()); } @@ -5782,6 +5783,18 @@ string SrsConfig::get_ff_log_dir() return conf->arg0(); } +string SrsConfig::get_ff_log_level() +{ + static string DEFAULT = "warning"; + + SrsConfDirective* conf = root->get("ff_log_level"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + + return conf->arg0(); +} + SrsConfDirective* SrsConfig::get_dash(string vhost) { SrsConfDirective* conf = get_vhost(vhost); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 9582b1235..e814b8777 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -783,6 +783,8 @@ public: // The ffmpeg log dir. // @remark, /dev/null to disable it. virtual std::string get_ff_log_dir(); + // The ffmpeg log level. + virtual std::string get_ff_log_level(); // The MPEG-DASH section. private: virtual SrsConfDirective* get_dash(std::string vhost); diff --git a/trunk/src/app/srs_app_ffmpeg.cpp b/trunk/src/app/srs_app_ffmpeg.cpp index 5c79bf992..e9c87a70e 100644 --- a/trunk/src/app/srs_app_ffmpeg.cpp +++ b/trunk/src/app/srs_app_ffmpeg.cpp @@ -82,9 +82,9 @@ SrsFFMPEG::~SrsFFMPEG() srs_freep(process); } -void SrsFFMPEG::set_iparams(string iparams) +void SrsFFMPEG::append_iparam(string iparam) { - _iparams = iparams; + iparams.push_back(iparam); } void SrsFFMPEG::set_oformat(string format) @@ -230,8 +230,11 @@ srs_error_t SrsFFMPEG::start() params.push_back(ffmpeg); // input params - if (!_iparams.empty()) { - params.push_back(_iparams); + for (int i = 0; i < iparams.size(); i++) { + string iparam = iparams.at(i); + if (!iparam.empty()) { + params.push_back(iparam); + } } // build the perfile diff --git a/trunk/src/app/srs_app_ffmpeg.hpp b/trunk/src/app/srs_app_ffmpeg.hpp index a837fdf24..452b7a564 100644 --- a/trunk/src/app/srs_app_ffmpeg.hpp +++ b/trunk/src/app/srs_app_ffmpeg.hpp @@ -45,7 +45,7 @@ private: std::string log_file; private: std::string ffmpeg; - std::string _iparams; + std::vector iparams; std::vector perfile; std::string iformat; std::string input; @@ -70,7 +70,7 @@ public: SrsFFMPEG(std::string ffmpeg_bin); virtual ~SrsFFMPEG(); public: - virtual void set_iparams(std::string iparams); + virtual void append_iparam(std::string iparam); virtual void set_oformat(std::string format); virtual std::string output(); public: diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index b9cbb30da..c98ed7d04 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -409,7 +409,13 @@ srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* log_file += stream; log_file += ".log"; } - + + std::string log_level = _srs_config->get_ff_log_level(); + if (!log_level.empty()) { + ffmpeg->append_iparam("-loglevel"); + ffmpeg->append_iparam(log_level); + } + // input std::string input_type = _srs_config->get_ingest_input_type(ingest); if (input_type.empty()) { @@ -423,7 +429,7 @@ srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* } // for file, set re. - ffmpeg->set_iparams("-re"); + ffmpeg->append_iparam("-re"); if ((err = ffmpeg->initialize(input_url, output, log_file)) != srs_success) { return srs_error_wrap(err, "init ffmpeg"); @@ -435,7 +441,7 @@ srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* } // for stream, no re. - ffmpeg->set_iparams(""); + ffmpeg->append_iparam(""); if ((err = ffmpeg->initialize(input_url, output, log_file)) != srs_success) { return srs_error_wrap(err, "init ffmpeg"); diff --git a/trunk/src/utest/srs_utest_config.cpp b/trunk/src/utest/srs_utest_config.cpp index d8538cb8d..1d03cefda 100644 --- a/trunk/src/utest/srs_utest_config.cpp +++ b/trunk/src/utest/srs_utest_config.cpp @@ -888,6 +888,11 @@ VOID TEST(ConfigMainTest, CheckConf_ff_log_dir) MockSrsConfig conf; HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "ff_log_dirs ./objs;")); } + + if (true) { + MockSrsConfig conf; + HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "ff_log_levels info;")); + } } VOID TEST(ConfigMainTest, CheckConf_srs_log_level) @@ -3503,11 +3508,12 @@ VOID TEST(ConfigMainTest, CheckVhostConfig5) if (true) { MockSrsConfig conf; - HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "srs_log_tank xxx;srs_log_level xxx2;srs_log_file xxx3;ff_log_dir xxx4;")); + HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "srs_log_tank xxx;srs_log_level xxx2;srs_log_file xxx3;ff_log_dir xxx4; ff_log_level xxx5;")); EXPECT_TRUE(conf.get_log_tank_file()); EXPECT_STREQ("xxx2", conf.get_log_level().c_str()); EXPECT_STREQ("xxx3", conf.get_log_file().c_str()); EXPECT_STREQ("xxx4", conf.get_ff_log_dir().c_str()); + EXPECT_STREQ("xxx5", conf.get_ff_log_level().c_str()); EXPECT_TRUE(conf.get_ff_log_enabled()); } From c6d914bc1360c43876ccb88f88586bc6a8c9389c Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Feb 2020 13:04:00 +0800 Subject: [PATCH 3/5] Fix #1592, fix terminal echo off by redirect process stdin. 3.0.115 --- README.md | 2 ++ trunk/conf/full.conf | 2 +- trunk/src/app/srs_app_config.cpp | 2 +- trunk/src/app/srs_app_process.cpp | 23 +++++++++++++---------- trunk/src/core/srs_core_version3.hpp | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ead8a55d2..f6e8e133e 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-02-05, For [#1592][bug #1592], fix terminal echo off by redirect process stdin. 3.0.115 * v3.0, 2020-02-04, For [#1186][bug #1186], refactor security check. 3.0.114 * v3.0, 2020-02-04, Fix [#939][bug #939], response right A/V flag in FLV header. 3.0.113 * v3.0, 2020-02-04, For [#939][bug #939], always enable fast FLV streaming. @@ -1642,6 +1643,7 @@ Winlin [bug #1206]: https://github.com/ossrs/srs/issues/1206 [bug #939]: https://github.com/ossrs/srs/issues/939 [bug #1186]: https://github.com/ossrs/srs/issues/1186 +[bug #1592]: https://github.com/ossrs/srs/issues/1592 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 9c7f720cd..afa9b700e 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -27,7 +27,7 @@ ff_log_dir ./objs; # the log level for FFMPEG. # info warning error fatal panic quiet # trace debug verbose -# default: warning +# default: info ff_log_level warning; # the log tank, console or file. # if console, print log to console. diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index ebb877f44..79a5b5caf 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -5785,7 +5785,7 @@ string SrsConfig::get_ff_log_dir() string SrsConfig::get_ff_log_level() { - static string DEFAULT = "warning"; + static string DEFAULT = "info"; SrsConfDirective* conf = root->get("ff_log_level"); if (!conf || conf->arg0().empty()) { diff --git a/trunk/src/app/srs_app_process.cpp b/trunk/src/app/srs_app_process.cpp index 2b50b9583..8ccc1b72e 100644 --- a/trunk/src/app/srs_app_process.cpp +++ b/trunk/src/app/srs_app_process.cpp @@ -152,7 +152,7 @@ srs_error_t srs_redirect_output(string from_file, int to_fd) // redirect the fd to file. int fd = -1; - int flags = O_CREAT|O_WRONLY|O_APPEND; + int flags = O_CREAT|O_RDWR|O_APPEND; mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; if ((fd = ::open(from_file.c_str(), flags, mode)) < 0) { @@ -197,10 +197,7 @@ srs_error_t SrsProcess::start() // ignore the SIGINT and SIGTERM signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); - - // for the stdin, - // should never close it or ffmpeg will error. - + // for the stdout, ignore when not specified. // redirect stdout to file if possible. if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) { @@ -212,16 +209,22 @@ srs_error_t SrsProcess::start() if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) { return srs_error_wrap(err, "redirect output"); } - + + // No stdin for process, @bug https://github.com/ossrs/srs/issues/1592 + if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) { + return srs_error_wrap(err, "redirect input"); + } + // should never close the fd 3+, for it myabe used. // for fd should close at exec, use fnctl to set it. // log basic info to stderr. if (true) { - fprintf(stderr, "\n"); - fprintf(stderr, "process ppid=%d, cid=%d, pid=%d\n", ppid, cid, getpid()); - fprintf(stderr, "process binary=%s, cli: %s\n", bin.c_str(), cli.c_str()); - fprintf(stderr, "process actual cli: %s\n", actual_cli.c_str()); + fprintf(stdout, "\n"); + fprintf(stdout, "process ppid=%d, cid=%d, pid=%d, in=%d, out=%d, err=%d\n", + ppid, cid, getpid(), STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO); + fprintf(stdout, "process binary=%s, cli: %s\n", bin.c_str(), cli.c_str()); + fprintf(stdout, "process actual cli: %s\n", actual_cli.c_str()); } // memory leak in child process, it's ok. diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index fe5e458d1..523b6f501 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 114 +#define SRS_VERSION3_REVISION 115 #endif From f6fa8893937fbfc0d91022a37cf797ae9bd4427c Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Feb 2020 13:20:37 +0800 Subject: [PATCH 4/5] For #1592, default ff_log_level to info --- trunk/conf/full.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index afa9b700e..c1e268ad8 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -28,7 +28,7 @@ ff_log_dir ./objs; # info warning error fatal panic quiet # trace debug verbose # default: info -ff_log_level warning; +ff_log_level info; # the log tank, console or file. # if console, print log to console. # if file, write log to file. requires srs_log_file if log to file. From fc769550db2bbfe87d080972da33065baf8c506a Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Feb 2020 14:17:30 +0800 Subject: [PATCH 5/5] Fix #665, fix HTTP-FLV reloading bug. 3.0.116 --- README.md | 2 + trunk/src/app/srs_app_http_stream.cpp | 67 ++++++++++++--------------- trunk/src/app/srs_app_http_stream.hpp | 3 ++ trunk/src/core/srs_core_version3.hpp | 2 +- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index f6e8e133e..2fb12cdf0 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-02-05, For [#665][bug #665], fix HTTP-FLV reloading bug. 3.0.116 * v3.0, 2020-02-05, For [#1592][bug #1592], fix terminal echo off by redirect process stdin. 3.0.115 * v3.0, 2020-02-04, For [#1186][bug #1186], refactor security check. 3.0.114 * v3.0, 2020-02-04, Fix [#939][bug #939], response right A/V flag in FLV header. 3.0.113 @@ -1644,6 +1645,7 @@ Winlin [bug #939]: https://github.com/ossrs/srs/issues/939 [bug #1186]: https://github.com/ossrs/srs/issues/1186 [bug #1592]: https://github.com/ossrs/srs/issues/1592 +[bug #665]: https://github.com/ossrs/srs/issues/665 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/app/srs_app_http_stream.cpp b/trunk/src/app/srs_app_http_stream.cpp index c7720be19..7a0688fff 100755 --- a/trunk/src/app/srs_app_http_stream.cpp +++ b/trunk/src/app/srs_app_http_stream.cpp @@ -809,6 +809,11 @@ SrsLiveEntry::SrsLiveEntry(std::string m) _is_aac = (ext == ".aac"); } +SrsLiveEntry::~SrsLiveEntry() +{ + srs_freep(req); +} + bool SrsLiveEntry::is_flv() { return _is_flv; @@ -846,7 +851,6 @@ SrsHttpStreamServer::~SrsHttpStreamServer() std::map::iterator it; for (it = tflvs.begin(); it != tflvs.end(); ++it) { SrsLiveEntry* entry = it->second; - srs_freep(entry->req); srs_freep(entry); } tflvs.clear(); @@ -901,7 +905,9 @@ srs_error_t SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r) mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/"); entry = new SrsLiveEntry(mount); - + + entry->source = s; + entry->req = r->copy()->as_http(); entry->cache = new SrsBufferCache(s, r); entry->stream = new SrsLiveStream(s, r, entry->cache); @@ -971,7 +977,8 @@ srs_error_t SrsHttpStreamServer::on_reload_vhost_added(string vhost) srs_error_t SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost) { srs_error_t err = srs_success; - + + // Create new vhost. if (tflvs.find(vhost) == tflvs.end()) { if ((err = initialize_flv_entry(vhost)) != srs_success) { return srs_error_wrap(err, "init flv entry"); @@ -981,41 +988,27 @@ srs_error_t SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost // and do mount automatically on playing http flv if this stream is a new http_remux stream. return err; } - - SrsLiveEntry* tmpl = tflvs[vhost]; - SrsRequest* req = tmpl->req; - SrsSource* source = tmpl->source; - - if (source && req) { - // cleanup the exists http remux. - http_unmount(source, req); - } - - if (!_srs_config->get_vhost_http_remux_enabled(vhost)) { - return err; - } - - string old_tmpl_mount = tmpl->mount; - string new_tmpl_mount = _srs_config->get_vhost_http_remux_mount(vhost); - - /** - * TODO: not support to reload different mount url for the time being. - * if the mount is change, need more logical thing to deal with. - * such as erase stream from sflvs and free all related resource. - */ - srs_assert(old_tmpl_mount == new_tmpl_mount); - - // do http mount directly with SrsRequest and SrsSource if stream is played already. - if (req) { - std::string sid = req->get_stream_url(); - - // remount stream. - if ((err = http_mount(source, req)) != srs_success) { - return srs_error_wrap(err, "vhost %s http_remux reload failed", vhost.c_str()); + + // Update all streams for exists vhost. + // TODO: FIMXE: If url changed, needs more things to deal with. + std::map::iterator it; + for (it = sflvs.begin(); it != sflvs.end(); ++it) { + SrsLiveEntry* entry = it->second; + if (!entry || !entry->req || !entry->source) { + continue; + } + + SrsRequest* req = entry->req; + if (!req || req->vhost != vhost) { + continue; + } + + SrsSource* source = entry->source; + if (_srs_config->get_vhost_http_remux_enabled(vhost)) { + http_mount(source, req); + } else { + http_unmount(source, req); } - } else { - // for without SrsRequest and SrsSource if stream is not played yet, do http mount automatically - // when start play this http flv stream. } srs_trace("vhost %s http_remux reload success", vhost.c_str()); diff --git a/trunk/src/app/srs_app_http_stream.hpp b/trunk/src/app/srs_app_http_stream.hpp index 720e53e3a..a82e2a5a0 100755 --- a/trunk/src/app/srs_app_http_stream.hpp +++ b/trunk/src/app/srs_app_http_stream.hpp @@ -207,7 +207,9 @@ private: bool _is_aac; bool _is_mp3; public: + // We will free the request. SrsRequest* req; + // Shared source. SrsSource* source; public: // For template, the mount contains variables. @@ -218,6 +220,7 @@ public: SrsBufferCache* cache; SrsLiveEntry(std::string m); + virtual ~SrsLiveEntry(); bool is_flv(); bool is_ts(); diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index 523b6f501..7b51a0991 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 115 +#define SRS_VERSION3_REVISION 116 #endif