From 24505fbe404ceabe368f08dbb8a3154dcfcb0992 Mon Sep 17 00:00:00 2001 From: zx <2200013083@stu.pku.edu.cn> Date: Thu, 10 Oct 2024 17:56:13 +0800 Subject: [PATCH] Instead just delete them, add a check for it --- trunk/src/protocol/srs_protocol_utility.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index e75ca436f..cc26249dd 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -52,6 +52,15 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh // rtmp://ip/app?vhost=VHOST/stream string fullUrl = srs_string_replace(tcUrl, "...vhost...", "?vhost="); + // Standard URL is: + // rtmp://ip/app/app2/stream?k=v + // Where after last slash is stream. + if (fullUrl.find_first_of("?#") == string::npos) + { + fullUrl += param.empty() ? "" : (param.at(0) == '?' ? param : "?" + param); + fullUrl += stream.empty() ? "/" : (stream.at(0) == '/' ? stream : "/" + stream); + } + // First, we covert the FMLE URL to standard URL: // rtmp://ip/app/app2?k=v/stream , or: // rtmp://ip/app/app2#k=v/stream