diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index d72b192e1b8..fecdb76a91c 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -187,7 +187,13 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe } // For RTMP to RTC, fail if disabled and RTMP is active, see https://github.com/ossrs/srs/issues/2728 - if (!_srs_config->get_rtc_from_rtmp(ruc.req_->vhost)) { + bool is_rtc_stream_active = false; + SrsRtcSource* source = _srs_rtc_sources->fetch(ruc.req_); + if (source && !source->can_publish()) { + is_rtc_stream_active = true; + } + + if (!is_rtc_stream_active && !_srs_config->get_rtc_from_rtmp(ruc.req_->vhost)) { SrsLiveSource* rtmp = _srs_sources->fetch(ruc.req_); if (rtmp && !rtmp->inactive()) { return srs_error_new(ERROR_RTC_DISABLED, "Disabled rtmp_to_rtc of %s, see #2728", ruc.req_->vhost.c_str()); diff --git a/trunk/src/app/srs_app_rtc_source.hpp b/trunk/src/app/srs_app_rtc_source.hpp index c98db956194..3c69b69d435 100644 --- a/trunk/src/app/srs_app_rtc_source.hpp +++ b/trunk/src/app/srs_app_rtc_source.hpp @@ -112,7 +112,7 @@ class SrsRtcSourceManager // @param r the client request. // @param pps the matched source, if success never be NULL. virtual srs_error_t fetch_or_create(SrsRequest* r, SrsRtcSource** pps); -private: +public: // Get the exists source, NULL when not exists. // update the request and return the exists source. virtual SrsRtcSource* fetch(SrsRequest* r);