diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index d72b192e1b8..f32e799e86a 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -188,7 +188,7 @@ 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)) { - SrsLiveSource* rtmp = _srs_sources->fetch(ruc.req_); + SrsLiveSource* rtmp = _srs_sources->fetch_src(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_source.cpp b/trunk/src/app/srs_app_source.cpp index d297f0f4aa2..07f29e64b14 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1759,6 +1759,16 @@ SrsLiveSource* SrsLiveSourceManager::fetch(SrsRequest* r) return source; } +SrsLiveSource* SrsLiveSourceManager::fetch_src(SrsRequest* r) +{ + string stream_url = r->get_stream_url(); + if (pool.find(stream_url) == pool.end()) { + return NULL; + } + + return pool[stream_url]; +} + void SrsLiveSourceManager::dispose() { std::map::iterator it; diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index d1bf0b3dc33..ccb7aa6b01e 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -448,10 +448,13 @@ class SrsLiveSourceManager : public ISrsHourGlass // @param h the event handler for source. // @param pps the matched source, if success never be NULL. virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps); -public: +private: // Get the exists source, NULL when not exists. // update the request and return the exists source. virtual SrsLiveSource* fetch(SrsRequest* r); +public: + // Get the exists source, NULL when not exists. + virtual SrsLiveSource* fetch_src(SrsRequest* r); public: // dispose and cycle all sources. virtual void dispose();