提高 rtmp tcUrl 解析兼容性 (#2303 #2298)

This commit is contained in:
TempoTian 2023-03-13 20:42:31 +08:00 committed by GitHub
parent b9fa5f9b5e
commit 5ae34d666e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);