From 5ae34d666ed4775ec03eb46ba5f87bd0c3c59ffd Mon Sep 17 00:00:00 2001 From: TempoTian <110106787+TempoTian@users.noreply.github.com> Date: Mon, 13 Mar 2023 20:42:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=AB=98=20rtmp=20tcUrl=20=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=85=BC=E5=AE=B9=E6=80=A7=20(#2303=20#2298)?= 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);