1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Compatible with legacy RTMP URL. v5.0.142. v6.0.27 (#3429)

For compatibility, transform
  rtmp://ip/app...vhost...VHOST/stream
to typical format:
  rtmp://ip/app/stream?vhost=VHOST

This is used for some legacy devices, which does not
support standard HTTP url query string.

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: john <hondaxiao@tencent.com>
This commit is contained in:
Winlin 2023-02-23 10:10:11 +08:00 committed by GitHub
parent 99ca66ddc8
commit b75668b509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 7 deletions

View file

@ -45,10 +45,15 @@ using namespace std;
void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vhost, string& app, string& stream, int& port, string& param)
{
// For compatibility, transform
// rtmp://ip/app...vhost...VHOST/stream
// to typical format:
// 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.
string fullUrl = tcUrl;
fullUrl += stream.empty() ? "/" : (stream.at(0) == '/' ? stream : "/" + stream);
fullUrl += param.empty() ? "" : (param.at(0) == '?' ? param : "?" + param);