From eaa1c54c143d23c8dcea7e1f15dcb437b101a5a5 Mon Sep 17 00:00:00 2001 From: hondaxiao Date: Thu, 8 Dec 2022 23:32:42 +0800 Subject: [PATCH 1/2] SRT: fix srt2rtc error --- trunk/src/app/srs_app_srt_conn.cpp | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/trunk/src/app/srs_app_srt_conn.cpp b/trunk/src/app/srs_app_srt_conn.cpp index a67ad9258e..2d18173303 100644 --- a/trunk/src/app/srs_app_srt_conn.cpp +++ b/trunk/src/app/srs_app_srt_conn.cpp @@ -19,6 +19,7 @@ using namespace std; #include #include #include +#include #include #include #include @@ -374,6 +375,39 @@ srs_error_t SrsMpegtsSrtConn::acquire_publish() live_source->set_cache(enabled_cache); live_source->set_gop_cache_max_frames(gcmf); + // srt->rtmp->rtc + // TODO: FIXME: the code below is repeat in srs_app_rtmp_conn.cpp, refactor it later, use function instead. + + // Check whether RTC stream is busy. +#ifdef SRS_RTC + SrsRtcSource *rtc = NULL; + bool rtc_server_enabled = _srs_config->get_rtc_server_enabled(); + bool rtc_enabled = _srs_config->get_rtc_enabled(req_->vhost); + bool edge = _srs_config->get_vhost_is_edge(req_->vhost); + if (rtc_server_enabled && rtc_enabled && ! edge) { + if ((err = _srs_rtc_sources->fetch_or_create(req_, &rtc)) != srs_success) { + return srs_error_wrap(err, "create source"); + } + + if (!rtc->can_publish()) { + return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtc stream %s busy", req_->get_stream_url().c_str()); + } + } +#endif + + // Bridge to RTC streaming. +#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT) + if (rtc) { + SrsRtcFromRtmpBridge *bridge = new SrsRtcFromRtmpBridge(rtc); + if ((err = bridge->initialize(req_)) != srs_success) { + srs_freep(bridge); + return srs_error_wrap(err, "bridge init"); + } + + live_source->set_bridge(bridge); + } +#endif + SrsRtmpFromSrtBridge *bridger = new SrsRtmpFromSrtBridge(live_source); if ((err = bridger->initialize(req_)) != srs_success) { srs_freep(bridger); From 0dbb17e1fa4f38bc00892c6d15706149edcd8812 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 9 Dec 2022 07:36:30 +0800 Subject: [PATCH 2/2] SRT: Support SRT to RTMP to WebRTC. v5.0.107 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version5.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index cd363edd11..c457b9d4b6 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2022-12-09, Merge [#3296](https://github.com/ossrs/srs/pull/3296): SRT: Support SRT to RTMP to WebRTC. v5.0.107 * v5.0, 2022-12-08, Merge [#3295](https://github.com/ossrs/srs/pull/3295): API: Parse fragment of URI. v5.0.106 * v5.0, 2022-12-04, Cygwin: Enable gb28181 for Windows. v5.0.105 * v5.0, 2022-12-04, Asan: Set asan loging callback. v5.0.104 diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 00a875889f..2483114935 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 106 +#define VERSION_REVISION 107 #endif