From 8e40f9cf22f86bf7f615b56cbc892b6c6fec8549 Mon Sep 17 00:00:00 2001 From: runner365 Date: Thu, 13 Feb 2020 16:52:26 +0800 Subject: [PATCH 1/2] update srt2rtmp about rtmp listen tcp port --- trunk/src/srt/srt_to_rtmp.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index 729e3e970b..79e2668be8 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -207,11 +208,22 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) } char url_sz[128]; + std::vector ip_ports = _srs_config->get_listens(); + int port = 0; + std::string ip; + + for (auto item : ip_ports) { + srs_parse_endpoint(item, ip, port); + if (port != 0) { + break; + } + } + if (_vhost == DEF_VHOST) { - sprintf(url_sz, "rtmp://127.0.0.1/%s/%s", + sprintf(url_sz, "rtmp://127.0.0.1:%d/%s/%s", port, _appname.c_str(), _streamname.c_str()); } else { - sprintf(url_sz, "rtmp://127.0.0.1/%s?vhost=%s/%s", + sprintf(url_sz, "rtmp://127.0.0.1:%d/%s?vhost=%s/%s", port, _appname.c_str(), _vhost.c_str(), _streamname.c_str()); } From 94741c167643a143be8b004238620ab77e803c70 Mon Sep 17 00:00:00 2001 From: runner365 Date: Thu, 13 Feb 2020 16:58:35 +0800 Subject: [PATCH 2/2] update srt2rtmp about rtmp listen tcp port --- trunk/src/srt/srt_to_rtmp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index 79e2668be8..13e83056d0 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -218,7 +218,7 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) break; } } - + port = (port == 0) ? 1935 : port; if (_vhost == DEF_VHOST) { sprintf(url_sz, "rtmp://127.0.0.1:%d/%s/%s", port, _appname.c_str(), _streamname.c_str());