Skip to content

Commit

Permalink
Merge v5.0.107 into develop
Browse files Browse the repository at this point in the history
* SRT: Support SRT to RTMP to WebRTC. v5.0.107 (#3296)
  • Loading branch information
winlinvip committed Dec 9, 2022
2 parents 3049fa7 + 56be854 commit 4f8f6ca
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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
Expand Down
34 changes: 34 additions & 0 deletions trunk/src/app/srs_app_srt_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using namespace std;
#include <srs_app_pithy_print.hpp>
#include <srs_app_srt_server.hpp>
#include <srs_app_srt_source.hpp>
#include <srs_app_rtc_source.hpp>
#include <srs_app_statistic.hpp>
#include <srs_protocol_rtmp_stack.hpp>
#include <srs_kernel_utility.hpp>
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 106
#define VERSION_REVISION 107

#endif

0 comments on commit 4f8f6ca

Please sign in to comment.