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

Bridger: Support RTC2RTMP bridger and shared FastTimer. 4.0.95

This commit is contained in:
winlin 2021-04-23 10:42:15 +08:00 committed by Winlin
parent c770e6d7bc
commit 3d225973ef
12 changed files with 700 additions and 4 deletions

View file

@ -998,6 +998,28 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcStreamDescripti
}
source->set_publish_stream(this);
// Bridge to rtmp
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req->vhost);
if (rtc_to_rtmp) {
SrsSource *rtmp = NULL;
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), &rtmp)) != srs_success) {
return srs_error_wrap(err, "create source");
}
// TODO: FIMXE: Check it in SrsRtcConnection::add_publisher?
if (!rtmp->can_publish(false)) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtmp stream %s busy", r->get_stream_url().c_str());
}
SrsRtmpFromRtcBridger *bridger = new SrsRtmpFromRtcBridger(rtmp);
if ((err = bridger->initialize(r)) != srs_success) {
srs_freep(bridger);
return srs_error_wrap(err, "create bridger");
}
source->set_bridger(bridger);
}
return err;
}