From a9ea8567e8fc46f3af4d2ad506d6609b8dfc0949 Mon Sep 17 00:00:00 2001 From: stone Date: Thu, 8 Apr 2021 16:55:17 +0800 Subject: [PATCH 1/2] Update srs_app_config.cpp bugfix: misleading error log information for transcode engine config param. --- trunk/src/app/srs_app_config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index cebebdb433..56fefb336a 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3796,7 +3796,7 @@ srs_error_t SrsConfig::check_normal_config() && e != "acodec" && e != "abitrate" && e != "asample_rate" && e != "achannels" && e != "aparams" && e != "output" && e != "perfile" && e != "iformat" && e != "oformat") { - return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal vhost.transcode.engine.%s of %s", m.c_str(), vhost->arg0().c_str()); + return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal vhost.transcode.engine.%s of %s", e.c_str(), vhost->arg0().c_str()); } } } From af76ab85b6e051e2f72bfb466394febc867a785b Mon Sep 17 00:00:00 2001 From: stone Date: Wed, 14 Apr 2021 15:11:32 +0800 Subject: [PATCH 2/2] bugfix: srs rejects request while downstream server disconnects and then reconnects in a short time. bugfix: while downstream server disconnects and reconnects in a short time, srs rejects the push request because SrsForwarder::cycle is sleeping for SRS_FORWARDER_CIMS, and the stream is still busy. --- trunk/src/app/srs_app_forward.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index 957ea7ccbd..1383fcf370 100755 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -179,25 +179,32 @@ srs_error_t SrsForwarder::on_video(SrsSharedPtrMessage* shared_video) srs_error_t SrsForwarder::cycle() { srs_error_t err = srs_success; - + while (true) { - // We always check status first. - // @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561 - if ((err = trd->pull()) != srs_success) { - return srs_error_wrap(err, "forwarder"); - } if ((err = do_cycle()) != srs_success) { srs_warn("Forwarder: Ignore error, %s", srs_error_desc(err).c_str()); srs_freep(err); } + // + // 将trd->pull()检测移到do_cycle之后,以便当正常的下游服务器断开连接的时候,不用再 + // srs_usleep(SRS_FORWARDER_CIMS),避免下游服务器马上重连的时候失败的情况发生。 + // + // We always check status first. + // @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561 + if ((err = trd->pull()) != srs_success) { + return srs_error_wrap(err, "forwarder"); + } + srs_usleep(SRS_FORWARDER_CIMS); } - + return err; } + + srs_error_t SrsForwarder::do_cycle() { srs_error_t err = srs_success;