From b78eb7fbb5914d13736a7da26658b153f3bd44ee Mon Sep 17 00:00:00 2001 From: sladro Date: Mon, 22 Dec 2025 14:42:21 +0800 Subject: [PATCH] update plugins/publish/publish_node.cpp --- plugins/publish/publish_node.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/publish/publish_node.cpp b/plugins/publish/publish_node.cpp index d88a754..b5a39e2 100644 --- a/plugins/publish/publish_node.cpp +++ b/plugins/publish/publish_node.cpp @@ -37,6 +37,7 @@ inline int Align16(int v) { return (v + 15) & ~15; } struct OutputConfig { std::string proto = "rtsp"; // rtsp | hls + std::string host = "127.0.0.1"; // rtsp server host to publish to int port = 8554; std::string path = "/live/stream"; // rtsp: url path; hls: dir or m3u8 path int segment_sec = 2; @@ -252,9 +253,10 @@ private: std::string BuildUrl(const OutputConfig& cfg) const { if (proto_ == "hls") return cfg.path; + std::string host = cfg.host.empty() ? "127.0.0.1" : cfg.host; std::string path = cfg.path; if (path.empty() || path[0] != '/') path = "/" + path; - return "rtsp://0.0.0.0:" + std::to_string(cfg.port) + path; + return "rtsp://" + host + ":" + std::to_string(cfg.port) + path; } OutputConfig cfg_; @@ -602,6 +604,7 @@ public: if (!o.IsObject()) continue; OutputConfig cfg; cfg.proto = o.ValueOr("proto", cfg.proto); + cfg.host = o.ValueOr("host", cfg.host); cfg.port = o.ValueOr("port", cfg.port); cfg.path = o.ValueOr("path", cfg.path); cfg.segment_sec = o.ValueOr("segment_sec", cfg.segment_sec);