From 107ca2cbb8c124d15f7941366e2fffb0658b7343 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 7 Mar 2022 15:52:46 +0800 Subject: [PATCH 1/2] SRT: Append vhost to stream, not app. v4.0.246 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- trunk/src/srt/srt_to_rtmp.cpp | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index e5073aa0f..ae578700d 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-03-07, SRT: Append vhost to stream, not app. v4.0.246 * v4.0, 2022-02-15, Fix warnings for uuid. v4.0.245 * v4.0, 2022-02-15, Merge [#2917](https://github.com/ossrs/srs/pull/2917): SRT: Close connection if RTMP failed. (#2917). v4.0.244 * v4.0, 2022-02-15, Refine build script for SRT to avoid warnings. v4.0.243 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index f74cfb24b..9ddb20103 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 245 +#define VERSION_REVISION 246 #endif diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index ea3922417..c904a6fe1 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -279,10 +279,11 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) ss << "rtmp://" << SRS_CONSTS_LOCALHOST; ss << ":" << port; ss << "/" << _appname; - if (_vhost != DEF_VHOST) { - ss << "?vhost=" << _vhost; - } ss << "/" << _streamname; + ss << (_streamname.find("?") != std::string::npos ? "&" : "?") << "upstream=srt"; + if (_vhost != DEF_VHOST) { + ss << "&vhost=" << _vhost; + } _url = ss.str(); From e26db694ca8e4da22fe022c04ae0b82ca269ccca Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 7 Mar 2022 16:34:51 +0800 Subject: [PATCH 2/2] RTC: Identify the WebRTC publisher in param for hooks. v4.0.247 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_rtc_api.cpp | 8 ++++---- trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index ae578700d..9af5fc13c 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-03-07, RTC: Identify the WebRTC publisher in param for hooks. v4.0.247 * v4.0, 2022-03-07, SRT: Append vhost to stream, not app. v4.0.246 * v4.0, 2022-02-15, Fix warnings for uuid. v4.0.245 * v4.0, 2022-02-15, Merge [#2917](https://github.com/ossrs/srs/pull/2917): SRT: Close connection if RTMP failed. (#2917). v4.0.244 diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index 38fd28c76..eb6679e11 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -394,9 +394,11 @@ srs_error_t SrsGoApiRtcPublish::do_serve_http(ISrsHttpResponseWriter* w, ISrsHtt ruc.api_ = api; srs_parse_rtmp_url(streamurl, ruc.req_->tcUrl, ruc.req_->stream); + srs_discovery_tc_url(ruc.req_->tcUrl, ruc.req_->schema, ruc.req_->host, ruc.req_->vhost, + ruc.req_->app, ruc.req_->stream, ruc.req_->port, ruc.req_->param); - srs_discovery_tc_url(ruc.req_->tcUrl, ruc.req_->schema, ruc.req_->host, ruc.req_->vhost, - ruc.req_->app, ruc.req_->stream, ruc.req_->port, ruc.req_->param); + // Identify WebRTC publisher by param upstream=rtc + ruc.req_->param = srs_string_trim_start(ruc.req_->param + "&upstream=rtc", "&"); // discovery vhost, resolve the vhost from config SrsConfDirective* parsed_vhost = _srs_config->get_vhost(ruc.req_->vhost); @@ -527,11 +529,9 @@ srs_error_t SrsGoApiRtcPublish::http_hooks_on_publish(SrsRequest* req) if (true) { SrsConfDirective* conf = _srs_config->get_vhost_on_publish(req->vhost); - if (!conf) { return err; } - hooks = conf->args; } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9ddb20103..7211b6a03 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 246 +#define VERSION_REVISION 247 #endif