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

RTC: fix play rtc judge for config rtc2rtmp on.(#2863) (#2872)

This commit is contained in:
chundonglinlin 2022-01-13 17:03:03 +08:00 committed by GitHub
parent 99ff853de9
commit 584889754c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -186,8 +186,15 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
server_enabled, rtc_enabled, ruc.req_->vhost.c_str());
}
// Whether RTC stream is active.
bool is_rtc_stream_active = false;
if (true) {
SrsRtcSource* source = _srs_rtc_sources->fetch(ruc.req_);
is_rtc_stream_active = (source && !source->can_publish());
}
// 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)) {
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());

View file

@ -112,7 +112,7 @@ public:
// @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.
virtual SrsRtcSource* fetch(SrsRequest* r);
};