From 3c148b4e9ae56b18e0b66038275a6223a7ee6258 Mon Sep 17 00:00:00 2001 From: tempo Date: Mon, 13 Mar 2023 15:21:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20RTMP=20tcURL=20=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/RtmpSession.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Rtmp/RtmpSession.cpp b/src/Rtmp/RtmpSession.cpp index 9d8acf51..c387ac91 100644 --- a/src/Rtmp/RtmpSession.cpp +++ b/src/Rtmp/RtmpSession.cpp @@ -95,6 +95,15 @@ void RtmpSession::onCmd_connect(AMFDecoder &dec) { //tc_url 中可能包含?以及参数,参见issue: #692 _tc_url = _tc_url.substr(0, pos); } + auto stream_start = _tc_url.rfind('/'); + if (stream_start != string::npos && stream_start > 1) { + auto protocol_end = _tc_url.find("://") + 2; + auto app_start = _tc_url.rfind('/', stream_start - 1); + if (app_start != protocol_end) { + // contain stream name part + _tc_url = _tc_url.substr(0, stream_start); + } + } } bool ok = true; //(app == APP_NAME); AMFValue version(AMF_OBJECT);