From 084bb6f7fc2b0353dd3a0871e2bbd35a570a4e03 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 30 Aug 2025 10:06:11 -0400 Subject: [PATCH] Remove most of reload, only keep framework. --- trunk/src/app/srs_app_dvr.cpp | 29 -------- trunk/src/app/srs_app_dvr.hpp | 6 -- trunk/src/app/srs_app_http_api.cpp | 10 --- trunk/src/app/srs_app_http_api.hpp | 3 - trunk/src/app/srs_app_http_static.cpp | 12 --- trunk/src/app/srs_app_http_static.hpp | 3 - trunk/src/app/srs_app_ingest.cpp | 103 -------------------------- trunk/src/app/srs_app_ingest.hpp | 7 -- trunk/src/app/srs_app_pithy_print.cpp | 6 -- trunk/src/app/srs_app_pithy_print.hpp | 3 - trunk/src/app/srs_app_rtc_conn.cpp | 19 ----- trunk/src/app/srs_app_rtc_conn.hpp | 3 - trunk/src/app/srs_app_rtc_server.cpp | 5 -- trunk/src/app/srs_app_rtc_server.hpp | 3 - trunk/src/app/srs_app_source.cpp | 84 --------------------- trunk/src/app/srs_app_source.hpp | 3 - 16 files changed, 299 deletions(-) diff --git a/trunk/src/app/srs_app_dvr.cpp b/trunk/src/app/srs_app_dvr.cpp index 25dd56435..dd7a3440f 100644 --- a/trunk/src/app/srs_app_dvr.cpp +++ b/trunk/src/app/srs_app_dvr.cpp @@ -221,20 +221,6 @@ srs_error_t SrsDvrSegmenter::on_update_duration(SrsSharedPtrMessage *msg) return srs_success; } -srs_error_t SrsDvrSegmenter::on_reload_vhost_dvr(std::string vhost) -{ - srs_error_t err = srs_success; - - if (req->vhost != vhost) { - return err; - } - - jitter_algorithm = (SrsRtmpJitterAlgorithm)_srs_config->get_dvr_time_jitter(req->vhost); - wait_keyframe = _srs_config->get_dvr_wait_keyframe(req->vhost); - - return err; -} - SrsDvrFlvSegmenter::SrsDvrFlvSegmenter() { enc = new SrsFlvTransmuxer(); @@ -917,21 +903,6 @@ srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage *msg) return err; } -srs_error_t SrsDvrSegmentPlan::on_reload_vhost_dvr(string vhost) -{ - srs_error_t err = srs_success; - - if (req->vhost != vhost) { - return err; - } - - wait_keyframe = _srs_config->get_dvr_wait_keyframe(req->vhost); - - cduration = _srs_config->get_dvr_duration(req->vhost); - - return err; -} - SrsDvr::SrsDvr() { hub = NULL; diff --git a/trunk/src/app/srs_app_dvr.hpp b/trunk/src/app/srs_app_dvr.hpp index 69edec222..60982b503 100644 --- a/trunk/src/app/srs_app_dvr.hpp +++ b/trunk/src/app/srs_app_dvr.hpp @@ -92,9 +92,6 @@ private: virtual std::string generate_path(); // When update the duration of segment by rtmp msg. virtual srs_error_t on_update_duration(SrsSharedPtrMessage *msg); - // Interface ISrsReloadHandler -public: - virtual srs_error_t on_reload_vhost_dvr(std::string vhost); }; // The FLV segmenter to use FLV encoder to write file. @@ -234,9 +231,6 @@ public: private: virtual srs_error_t update_duration(SrsSharedPtrMessage *msg); - // Interface ISrsReloadHandler -public: - virtual srs_error_t on_reload_vhost_dvr(std::string vhost); }; // DVR(Digital Video Recorder) to record RTMP stream to flv/mp4 file. diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index 938e23672..066aa2762 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -962,16 +962,6 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage * return err; } -srs_error_t SrsGoApiRaw::on_reload_http_api_raw_api() -{ - raw_api = _srs_config->get_raw_api(); - allow_reload = _srs_config->get_raw_api_allow_reload(); - allow_query = _srs_config->get_raw_api_allow_query(); - allow_update = _srs_config->get_raw_api_allow_update(); - - return srs_success; -} - SrsGoApiClusters::SrsGoApiClusters() { } diff --git a/trunk/src/app/srs_app_http_api.hpp b/trunk/src/app/srs_app_http_api.hpp index ff639dd15..d50571240 100644 --- a/trunk/src/app/srs_app_http_api.hpp +++ b/trunk/src/app/srs_app_http_api.hpp @@ -200,9 +200,6 @@ public: public: virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); - // Interface ISrsReloadHandler -public: - virtual srs_error_t on_reload_http_api_raw_api(); }; class SrsGoApiClusters : public ISrsHttpHandler diff --git a/trunk/src/app/srs_app_http_static.cpp b/trunk/src/app/srs_app_http_static.cpp index 2d8994a2c..16b7e7fc2 100644 --- a/trunk/src/app/srs_app_http_static.cpp +++ b/trunk/src/app/srs_app_http_static.cpp @@ -687,15 +687,3 @@ srs_error_t SrsHttpStaticServer::mount_vhost(string vhost, string &pmount) return err; } - -srs_error_t SrsHttpStaticServer::on_reload_vhost_added(string vhost) -{ - srs_error_t err = srs_success; - - string pmount; - if ((err = mount_vhost(vhost, pmount)) != srs_success) { - return srs_error_wrap(err, "mount vhost"); - } - - return err; -} diff --git a/trunk/src/app/srs_app_http_static.hpp b/trunk/src/app/srs_app_http_static.hpp index 97df3d66a..c42afebde 100644 --- a/trunk/src/app/srs_app_http_static.hpp +++ b/trunk/src/app/srs_app_http_static.hpp @@ -104,9 +104,6 @@ public: private: virtual srs_error_t mount_vhost(std::string vhost, std::string &pmount); - // Interface ISrsReloadHandler. -public: - virtual srs_error_t on_reload_vhost_added(std::string vhost); }; #endif diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index 94c1c14ec..fc314363e 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -483,106 +483,3 @@ void SrsIngester::show_ingest_log_message() srsu2msi(pprint_->age()), (int)ingesters.size(), index, srsu2msi(ingester->alive()), ingester->uri().c_str()); } } - -srs_error_t SrsIngester::on_reload_vhost_removed(string vhost) -{ - srs_error_t err = srs_success; - - std::vector::iterator it; - - for (it = ingesters.begin(); it != ingesters.end();) { - SrsIngesterFFMPEG *ingester = *it; - - if (!ingester->equals(vhost)) { - ++it; - continue; - } - - // stop the ffmpeg and free it. - ingester->stop(); - - srs_trace("reload stop ingester, vhost=%s, id=%s", vhost.c_str(), ingester->uri().c_str()); - - srs_freep(ingester); - - // remove the item from ingesters. - it = ingesters.erase(it); - } - - return err; -} - -srs_error_t SrsIngester::on_reload_vhost_added(string vhost) -{ - srs_error_t err = srs_success; - - SrsConfDirective *_vhost = _srs_config->get_vhost(vhost); - if ((err = parse_ingesters(_vhost)) != srs_success) { - return srs_error_wrap(err, "parse ingesters"); - } - - srs_trace("reload add vhost ingesters, vhost=%s", vhost.c_str()); - - return err; -} - -srs_error_t SrsIngester::on_reload_ingest_removed(string vhost, string ingest_id) -{ - srs_error_t err = srs_success; - - std::vector::iterator it; - - for (it = ingesters.begin(); it != ingesters.end();) { - SrsIngesterFFMPEG *ingester = *it; - - if (!ingester->equals(vhost, ingest_id)) { - ++it; - continue; - } - - // stop the ffmpeg and free it. - ingester->stop(); - - srs_trace("reload stop ingester, vhost=%s, id=%s", vhost.c_str(), ingester->uri().c_str()); - - srs_freep(ingester); - - // remove the item from ingesters. - it = ingesters.erase(it); - } - - return err; -} - -srs_error_t SrsIngester::on_reload_ingest_added(string vhost, string ingest_id) -{ - srs_error_t err = srs_success; - - SrsConfDirective *_vhost = _srs_config->get_vhost(vhost); - SrsConfDirective *_ingester = _srs_config->get_ingest_by_id(vhost, ingest_id); - - if ((err = parse_engines(_vhost, _ingester)) != srs_success) { - return srs_error_wrap(err, "parse engines"); - } - - srs_trace("reload add ingester, vhost=%s, id=%s", vhost.c_str(), ingest_id.c_str()); - - return err; -} - -srs_error_t SrsIngester::on_reload_ingest_updated(string vhost, string ingest_id) -{ - srs_error_t err = srs_success; - - if ((err = on_reload_ingest_removed(vhost, ingest_id)) != srs_success) { - return srs_error_wrap(err, "reload ingest removed"); - } - - if ((err = on_reload_ingest_added(vhost, ingest_id)) != srs_success) { - return srs_error_wrap(err, "reload ingest added"); - } - - srs_trace("reload updated ingester, vhost=%s, id=%s", vhost.c_str(), ingest_id.c_str()); - - return err; -} diff --git a/trunk/src/app/srs_app_ingest.hpp b/trunk/src/app/srs_app_ingest.hpp index 80c15025a..557cd8f1c 100644 --- a/trunk/src/app/srs_app_ingest.hpp +++ b/trunk/src/app/srs_app_ingest.hpp @@ -96,13 +96,6 @@ private: virtual srs_error_t parse_engines(SrsConfDirective *vhost, SrsConfDirective *ingest); virtual srs_error_t initialize_ffmpeg(SrsFFMPEG *ffmpeg, SrsConfDirective *vhost, SrsConfDirective *ingest, SrsConfDirective *engine); virtual void show_ingest_log_message(); - // Interface ISrsReloadHandler. -public: - virtual srs_error_t on_reload_vhost_removed(std::string vhost); - virtual srs_error_t on_reload_vhost_added(std::string vhost); - virtual srs_error_t on_reload_ingest_removed(std::string vhost, std::string ingest_id); - virtual srs_error_t on_reload_ingest_added(std::string vhost, std::string ingest_id); - virtual srs_error_t on_reload_ingest_updated(std::string vhost, std::string ingest_id); }; #endif diff --git a/trunk/src/app/srs_app_pithy_print.cpp b/trunk/src/app/srs_app_pithy_print.cpp index 596adcba3..9265eaae1 100644 --- a/trunk/src/app/srs_app_pithy_print.cpp +++ b/trunk/src/app/srs_app_pithy_print.cpp @@ -54,12 +54,6 @@ bool SrsStageInfo::can_print() return can_print; } -srs_error_t SrsStageInfo::on_reload_pithy_print() -{ - update_print_time(); - return srs_success; -} - SrsStageManager::SrsStageManager() { } diff --git a/trunk/src/app/srs_app_pithy_print.hpp b/trunk/src/app/srs_app_pithy_print.hpp index 11d5c3f01..ad98fa8b8 100644 --- a/trunk/src/app/srs_app_pithy_print.hpp +++ b/trunk/src/app/srs_app_pithy_print.hpp @@ -36,9 +36,6 @@ public: public: virtual void elapse(srs_utime_t diff); virtual bool can_print(); - -public: - virtual srs_error_t on_reload_pithy_print(); }; // The manager for stages, it's used for a single client stage. diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index f3440042c..b74731956 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -580,25 +580,6 @@ void SrsRtcPlayStream::on_stream_change(SrsRtcSourceDescription *desc) } } -srs_error_t SrsRtcPlayStream::on_reload_vhost_play(string vhost) -{ - if (req_->vhost != vhost) { - return srs_success; - } - - realtime = _srs_config->get_realtime_enabled(req_->vhost, true); - mw_msgs = _srs_config->get_mw_msgs(req_->vhost, realtime, true); - - srs_trace("Reload play realtime=%d, mw_msgs=%d", realtime, mw_msgs); - - return srs_success; -} - -srs_error_t SrsRtcPlayStream::on_reload_vhost_realtime(string vhost) -{ - return on_reload_vhost_play(vhost); -} - const SrsContextId &SrsRtcPlayStream::context_id() { return cid_; diff --git a/trunk/src/app/srs_app_rtc_conn.hpp b/trunk/src/app/srs_app_rtc_conn.hpp index 3099327b2..ef40c9b9a 100644 --- a/trunk/src/app/srs_app_rtc_conn.hpp +++ b/trunk/src/app/srs_app_rtc_conn.hpp @@ -270,10 +270,7 @@ public: // Interface ISrsRtcSourceChangeCallback public: void on_stream_change(SrsRtcSourceDescription *desc); - // interface ISrsReloadHandler public: - virtual srs_error_t on_reload_vhost_play(std::string vhost); - virtual srs_error_t on_reload_vhost_realtime(std::string vhost); virtual const SrsContextId &context_id(); public: diff --git a/trunk/src/app/srs_app_rtc_server.cpp b/trunk/src/app/srs_app_rtc_server.cpp index 1a4d86792..bd9875872 100644 --- a/trunk/src/app/srs_app_rtc_server.cpp +++ b/trunk/src/app/srs_app_rtc_server.cpp @@ -348,11 +348,6 @@ srs_error_t SrsRtcServer::initialize() return err; } -srs_error_t SrsRtcServer::on_reload_rtc_server() -{ - return srs_success; -} - srs_error_t SrsRtcServer::exec_async_work(ISrsAsyncCallTask *t) { return async->execute(t); diff --git a/trunk/src/app/srs_app_rtc_server.hpp b/trunk/src/app/srs_app_rtc_server.hpp index 177609437..4a87d00c6 100644 --- a/trunk/src/app/srs_app_rtc_server.hpp +++ b/trunk/src/app/srs_app_rtc_server.hpp @@ -95,9 +95,6 @@ public: public: virtual srs_error_t initialize(); - // interface ISrsReloadHandler -public: - virtual srs_error_t on_reload_rtc_server(); public: srs_error_t exec_async_work(ISrsAsyncCallTask *t); diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 8ffff82aa..859a9fc14 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1857,90 +1857,6 @@ void SrsLiveSource::set_bridge(ISrsStreamBridge *v) bridge_ = v; } -srs_error_t SrsLiveSource::on_reload_vhost_play(string vhost) -{ - srs_error_t err = srs_success; - - if (req->vhost != vhost) { - return err; - } - - // time_jitter - jitter_algorithm = (SrsRtmpJitterAlgorithm)_srs_config->get_time_jitter(req->vhost); - - // mix_correct - if (true) { - bool v = _srs_config->get_mix_correct(req->vhost); - - // when changed, clear the mix queue. - if (v != mix_correct) { - mix_queue->clear(); - } - mix_correct = v; - } - - // atc changed. - if (true) { - bool v = _srs_config->get_atc(vhost); - - if (v != atc) { - srs_warn("vhost %s atc changed to %d, connected client may corrupt.", vhost.c_str(), v); - gop_cache->clear(); - } - atc = v; - } - - // gop cache changed. - if (true) { - bool v = _srs_config->get_gop_cache(vhost); - - if (v != gop_cache->enabled()) { - string url = req->get_stream_url(); - srs_trace("vhost %s gop_cache changed to %d, source url=%s", vhost.c_str(), v, url.c_str()); - gop_cache->set(v); - gop_cache->set_gop_cache_max_frames(_srs_config->get_gop_cache_max_frames(vhost)); - } - } - - // queue length - if (true) { - srs_utime_t v = _srs_config->get_queue_length(req->vhost); - - if (true) { - std::vector::iterator it; - - for (it = consumers.begin(); it != consumers.end(); ++it) { - SrsLiveConsumer *consumer = *it; - consumer->set_queue_size(v); - } - - srs_trace("consumers reload queue size success."); - } - - // TODO: FIXME: https://github.com/ossrs/srs/issues/742#issuecomment-273656897 - // TODO: FIXME: support queue size. -#if 0 - if (true) { - std::vector::iterator it; - - for (it = forwarders.begin(); it != forwarders.end(); ++it) { - SrsForwarder* forwarder = *it; - forwarder->set_queue_size(v); - } - - srs_trace("forwarders reload queue size success."); - } - - if (true) { - publish_edge->set_queue_size(v); - srs_trace("publish_edge reload queue size success."); - } -#endif - } - - return err; -} - srs_error_t SrsLiveSource::on_source_id_changed(SrsContextId id) { srs_error_t err = srs_success; diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 9f5ae2e6c..6ce12e9ad 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -577,9 +577,6 @@ public: virtual srs_error_t initialize(SrsSharedPtr wrapper, ISrsRequest *r); // Bridge to other source, forward packets to it. void set_bridge(ISrsStreamBridge *v); - // Interface ISrsReloadHandler -public: - virtual srs_error_t on_reload_vhost_play(std::string vhost); public: // The source id changed.