Skip to content

Commit

Permalink
RTC: Fix both rtmp and rtc streams can be published at the same time. (
Browse files Browse the repository at this point in the history
  • Loading branch information
chundonglinlin authored Jan 12, 2022
1 parent e08c68b commit c30aa47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,20 +1183,20 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcSourceDescripti
}
source->set_publish_stream(this);

// TODO: FIMXE: Check it in SrsRtcConnection::add_publisher?
SrsLiveSource *rtmp = _srs_sources->fetch(r);
if (rtmp && !rtmp->can_publish(false)) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtmp stream %s busy", r->get_stream_url().c_str());
}

// Bridge to rtmp
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req_->vhost);
if (rtc_to_rtmp) {
SrsLiveSource *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());
}

// Disable GOP cache for RTC2RTMP bridger, to keep the streams in sync,
// especially for stream merging.
rtmp->set_cache(false);
Expand Down

0 comments on commit c30aa47

Please sign in to comment.