winlin

add atc_auto to disable or enable auto detect atc

@@ -223,6 +223,12 @@ vhost atc.srs.com { @@ -223,6 +223,12 @@ vhost atc.srs.com {
223 # 223 #
224 # default: off 224 # default: off
225 atc on; 225 atc on;
  226 + # whether enable the auto atc,
  227 + # if enabled, detect the bravo_atc="true" in onMetaData packet,
  228 + # set atc to on if matched.
  229 + # always ignore the onMetaData if atc_auto is off.
  230 + # default: on
  231 + atc_auto on;
226 } 232 }
227 233
228 # vhost for bandwidth check 234 # vhost for bandwidth check
@@ -1654,7 +1654,7 @@ bool SrsConfig::get_atc(string vhost) @@ -1654,7 +1654,7 @@ bool SrsConfig::get_atc(string vhost)
1654 SrsConfDirective* conf = get_vhost(vhost); 1654 SrsConfDirective* conf = get_vhost(vhost);
1655 1655
1656 if (!conf) { 1656 if (!conf) {
1657 - return true; 1657 + return false;
1658 } 1658 }
1659 1659
1660 conf = conf->get("atc"); 1660 conf = conf->get("atc");
@@ -1665,6 +1665,22 @@ bool SrsConfig::get_atc(string vhost) @@ -1665,6 +1665,22 @@ bool SrsConfig::get_atc(string vhost)
1665 return false; 1665 return false;
1666 } 1666 }
1667 1667
  1668 +bool SrsConfig::get_atc_auto(string vhost)
  1669 +{
  1670 + SrsConfDirective* conf = get_vhost(vhost);
  1671 +
  1672 + if (!conf) {
  1673 + return true;
  1674 + }
  1675 +
  1676 + conf = conf->get("atc_auto");
  1677 + if (conf && conf->arg0() == "off") {
  1678 + return false;
  1679 + }
  1680 +
  1681 + return true;
  1682 +}
  1683 +
1668 double SrsConfig::get_queue_length(string vhost) 1684 double SrsConfig::get_queue_length(string vhost)
1669 { 1685 {
1670 SrsConfDirective* conf = get_vhost(vhost); 1686 SrsConfDirective* conf = get_vhost(vhost);
@@ -180,6 +180,7 @@ public: @@ -180,6 +180,7 @@ public:
180 virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost); 180 virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost);
181 virtual bool get_gop_cache(std::string vhost); 181 virtual bool get_gop_cache(std::string vhost);
182 virtual bool get_atc(std::string vhost); 182 virtual bool get_atc(std::string vhost);
  183 + virtual bool get_atc_auto(std::string vhost);
183 virtual double get_queue_length(std::string vhost); 184 virtual double get_queue_length(std::string vhost);
184 virtual SrsConfDirective* get_forward(std::string vhost); 185 virtual SrsConfDirective* get_forward(std::string vhost);
185 virtual SrsConfDirective* get_refer(std::string vhost); 186 virtual SrsConfDirective* get_refer(std::string vhost);
@@ -822,11 +822,13 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata) @@ -822,11 +822,13 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata)
822 } 822 }
823 } 823 }
824 824
825 - // if bravo-atc, open atc for vhost. 825 + // if allow atc_auto and bravo-atc detected, open atc for vhost.
826 atc = _srs_config->get_atc(_req->vhost); 826 atc = _srs_config->get_atc(_req->vhost);
827 - if ((prop = metadata->metadata->get_property("bravo_atc")) != NULL) {  
828 - if (prop->is_string() && prop->to_str() == "true") {  
829 - atc = true; 827 + if (_srs_config->get_atc_auto(_req->vhost)) {
  828 + if ((prop = metadata->metadata->get_property("bravo_atc")) != NULL) {
  829 + if (prop->is_string() && prop->to_str() == "true") {
  830 + atc = true;
  831 + }
830 } 832 }
831 } 833 }
832 834
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "85" 34 +#define VERSION_REVISION "86"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "srs" 37 #define RTMP_SIG_SRS_KEY "srs"