From f995bf7ca8270f8512dba738265eff53835d915e Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 6 May 2021 17:39:10 +0800 Subject: [PATCH] SquashSRS4: Transform config for nack/twcc. --- trunk/src/app/srs_app_config.cpp | 31 ++++++++++++++++++++++++++-- trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 76bb71eb3..33edb4ff2 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -452,7 +452,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root) continue; } - // SRS3.0, change the folowing like a shadow: + // SRS3.0, change the bellow like a shadow: // time_jitter, mix_correct, atc, atc_auto, mw_latency, gop_cache, queue_length // SRS1/2: // vhost { shadow; } @@ -489,7 +489,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root) continue; } - // SRS3.0, change the folowing like a shadow: + // SRS3.0, change the bellow like a shadow: // mode, origin, token_traverse, vhost, debug_srs_upnode // SRS1/2: // vhost { shadow; } @@ -506,6 +506,33 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root) srs_freep(conf); continue; } + + // SRS4.0, move nack/twcc to rtc: + // vhost { nack {enabled; no_copy;} twcc {enabled} } + // as: + // vhost { rtc { nack on; nack_no_copy on; twcc on; } } + if (n == "nack" || n == "twcc") { + it = dir->directives.erase(it); + + SrsConfDirective* rtc = dir->get_or_create("rtc"); + if (n == "nack") { + if (conf->get("enabled")) { + rtc->get_or_create("nack")->args = conf->get("enabled")->args; + } + + if (conf->get("no_copy")) { + rtc->get_or_create("nack_no_copy")->args = conf->get("no_copy")->args; + } + } else if (n == "twcc") { + if (conf->get("enabled")) { + rtc->get_or_create("twcc")->args = conf->get("enabled")->args; + } + } + srs_warn("transform: vhost.%s to vhost.rtc.%s of %s", n.c_str(), n.c_str(), dir->name.c_str()); + + srs_freep(conf); + continue; + } ++it; } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 3c6df669c..90e4226c5 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -26,6 +26,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 99 +#define VERSION_REVISION 100 #endif