mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Fix both rtmp and rtc streams can be published at the same time. (#2875)
This commit is contained in:
parent
e08c68b917
commit
c30aa479a7
1 changed files with 6 additions and 6 deletions
|
@ -1183,20 +1183,20 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcSourceDescripti
|
||||||
}
|
}
|
||||||
source->set_publish_stream(this);
|
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
|
// Bridge to rtmp
|
||||||
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
||||||
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req_->vhost);
|
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req_->vhost);
|
||||||
if (rtc_to_rtmp) {
|
if (rtc_to_rtmp) {
|
||||||
SrsLiveSource *rtmp = NULL;
|
|
||||||
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), &rtmp)) != srs_success) {
|
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), &rtmp)) != srs_success) {
|
||||||
return srs_error_wrap(err, "create source");
|
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,
|
// Disable GOP cache for RTC2RTMP bridger, to keep the streams in sync,
|
||||||
// especially for stream merging.
|
// especially for stream merging.
|
||||||
rtmp->set_cache(false);
|
rtmp->set_cache(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue