From fc501b050b11c78189b4d9d9553832d82d688c2e Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 30 Apr 2014 12:08:11 +0800 Subject: [PATCH] add atc_auto to disable or enable auto detect atc --- trunk/conf/full.conf | 6 ++++++ trunk/src/app/srs_app_config.cpp | 18 +++++++++++++++++- trunk/src/app/srs_app_config.hpp | 1 + trunk/src/app/srs_app_source.cpp | 10 ++++++---- trunk/src/core/srs_core.hpp | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index a18b8d170..252deaca9 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -223,6 +223,12 @@ vhost atc.srs.com { # # default: off atc on; + # whether enable the auto atc, + # if enabled, detect the bravo_atc="true" in onMetaData packet, + # set atc to on if matched. + # always ignore the onMetaData if atc_auto is off. + # default: on + atc_auto on; } # vhost for bandwidth check diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 318dc3617..69b6b2977 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1654,7 +1654,7 @@ bool SrsConfig::get_atc(string vhost) SrsConfDirective* conf = get_vhost(vhost); if (!conf) { - return true; + return false; } conf = conf->get("atc"); @@ -1665,6 +1665,22 @@ bool SrsConfig::get_atc(string vhost) return false; } +bool SrsConfig::get_atc_auto(string vhost) +{ + SrsConfDirective* conf = get_vhost(vhost); + + if (!conf) { + return true; + } + + conf = conf->get("atc_auto"); + if (conf && conf->arg0() == "off") { + return false; + } + + return true; +} + double SrsConfig::get_queue_length(string vhost) { SrsConfDirective* conf = get_vhost(vhost); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 44ceb219a..cde7112f9 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -180,6 +180,7 @@ public: virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost); virtual bool get_gop_cache(std::string vhost); virtual bool get_atc(std::string vhost); + virtual bool get_atc_auto(std::string vhost); virtual double get_queue_length(std::string vhost); virtual SrsConfDirective* get_forward(std::string vhost); virtual SrsConfDirective* get_refer(std::string vhost); diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 9e39b2cb3..23efd4e4e 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -822,11 +822,13 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata) } } - // if bravo-atc, open atc for vhost. + // if allow atc_auto and bravo-atc detected, open atc for vhost. atc = _srs_config->get_atc(_req->vhost); - if ((prop = metadata->metadata->get_property("bravo_atc")) != NULL) { - if (prop->is_string() && prop->to_str() == "true") { - atc = true; + if (_srs_config->get_atc_auto(_req->vhost)) { + if ((prop = metadata->metadata->get_property("bravo_atc")) != NULL) { + if (prop->is_string() && prop->to_str() == "true") { + atc = true; + } } } diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 5b9334613..daa9e9a24 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR "0" #define VERSION_MINOR "9" -#define VERSION_REVISION "85" +#define VERSION_REVISION "86" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "srs"