From 0f791cbf06f33c7408660bc062b4e8f074f414b4 Mon Sep 17 00:00:00 2001 From: zx <2200013083@stu.pku.edu.cn> Date: Wed, 9 Oct 2024 21:33:35 +0800 Subject: [PATCH 1/4] Remove line 59 in trunk/src/protocol/srs_protocol_utility.cpp, for it cause the repeat of the param --- trunk/src/protocol/srs_protocol_utility.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 620ebfea4..07f63175f 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -56,7 +56,6 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh // rtmp://ip/app/app2/stream?k=v // Where after last slash is stream. fullUrl += stream.empty() ? "/" : (stream.at(0) == '/' ? stream : "/" + stream); - fullUrl += param.empty() ? "" : (param.at(0) == '?' ? param : "?" + param); // First, we covert the FMLE URL to standard URL: // rtmp://ip/app/app2?k=v/stream , or: From 036d3c0019e56d74d29d833d16f7d4f7aed32883 Mon Sep 17 00:00:00 2001 From: zx <2200013083@stu.pku.edu.cn> Date: Thu, 10 Oct 2024 17:31:29 +0800 Subject: [PATCH 2/4] for tcurl is already containing stream and param, don't need to add to it again --- trunk/src/protocol/srs_protocol_utility.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 07f63175f..e75ca436f 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -52,11 +52,6 @@ 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. - 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 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 3/4] 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 From 15d6458b854ec2f02058b2a82d5e19b22c870420 Mon Sep 17 00:00:00 2001 From: zx <2200013083@stu.pku.edu.cn> Date: Thu, 10 Oct 2024 19:04:26 +0800 Subject: [PATCH 4/4] check for param should not cover the append of stream --- trunk/src/protocol/srs_protocol_utility.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index cc26249dd..46c13e554 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -55,11 +55,9 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh // Standard URL is: // rtmp://ip/app/app2/stream?k=v // Where after last slash is stream. + fullUrl += stream.empty() ? "/" : (stream.at(0) == '/' ? stream : "/" + 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: