mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Support composited bridges for 1:N protocols converting. v6.0.41 (#3392)
Co-authored-by: john <hondaxiao@tencent.com> Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
parent
771ae0a1a6
commit
dcd02fe69c
19 changed files with 770 additions and 400 deletions
|
@ -39,6 +39,7 @@ using namespace std;
|
|||
#include <srs_protocol_json.hpp>
|
||||
#include <srs_app_rtc_source.hpp>
|
||||
#include <srs_app_tencentcloud.hpp>
|
||||
#include <srs_app_srt_source.hpp>
|
||||
|
||||
// the timeout in srs_utime_t to wait encoder to republish
|
||||
// if timeout, close the connection.
|
||||
|
@ -1081,7 +1082,7 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
|
|||
|
||||
// Check whether RTC stream is busy.
|
||||
#ifdef SRS_RTC
|
||||
SrsRtcSource *rtc = NULL;
|
||||
SrsRtcSource* rtc = NULL;
|
||||
bool rtc_server_enabled = _srs_config->get_rtc_server_enabled();
|
||||
bool rtc_enabled = _srs_config->get_rtc_enabled(req->vhost);
|
||||
if (rtc_server_enabled && rtc_enabled && !info->edge) {
|
||||
|
@ -1095,10 +1096,28 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
|
|||
}
|
||||
#endif
|
||||
|
||||
// Check whether SRT stream is busy.
|
||||
#ifdef SRS_SRT
|
||||
SrsSrtSource* srt = NULL;
|
||||
bool srt_server_enabled = _srs_config->get_srt_enabled();
|
||||
bool srt_enabled = _srs_config->get_srt_enabled(req->vhost);
|
||||
if (srt_server_enabled && srt_enabled && !info->edge) {
|
||||
if ((err = _srs_srt_sources->fetch_or_create(req, &srt)) != srs_success) {
|
||||
return srs_error_wrap(err, "create source");
|
||||
}
|
||||
|
||||
if (!srt->can_publish()) {
|
||||
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "srt 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 (rtc && _srs_config->get_rtc_from_rtmp(req->vhost)) {
|
||||
SrsCompositeBridge* bridge = new SrsCompositeBridge();
|
||||
bridge->append(new SrsFrameToRtcBridge(rtc));
|
||||
|
||||
if ((err = bridge->initialize(req)) != srs_success) {
|
||||
srs_freep(bridge);
|
||||
return srs_error_wrap(err, "bridge init");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue