winlin

auto open atc for bravo_atc set

@@ -2656,6 +2656,29 @@ string SrsConfig::get_vhost_http_dir(string vhost) @@ -2656,6 +2656,29 @@ string SrsConfig::get_vhost_http_dir(string vhost)
2656 return conf->arg0(); 2656 return conf->arg0();
2657 } 2657 }
2658 2658
  2659 +void SrsConfig::set_atc(std::string vhost, bool atc)
  2660 +{
  2661 + SrsConfDirective* conf = get_vhost(vhost);
  2662 + if (!conf) {
  2663 + return;
  2664 + }
  2665 +
  2666 + // create if not exists
  2667 + if (conf->get("atc") == NULL) {
  2668 + SrsConfDirective* o = new SrsConfDirective();
  2669 + o->name = "atc";
  2670 + conf->directives.push_back(o);
  2671 + }
  2672 +
  2673 + // get the atc node
  2674 + conf = conf->get("atc");
  2675 + srs_assert(conf);
  2676 +
  2677 + // refresh
  2678 + conf->directives.clear();
  2679 + conf->args.push_back((atc? "true":"false"));
  2680 +}
  2681 +
2659 bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b) 2682 bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b)
2660 { 2683 {
2661 // both NULL, equal. 2684 // both NULL, equal.
@@ -269,6 +269,9 @@ public: @@ -269,6 +269,9 @@ public:
269 virtual bool get_vhost_http_enabled(std::string vhost); 269 virtual bool get_vhost_http_enabled(std::string vhost);
270 virtual std::string get_vhost_http_mount(std::string vhost); 270 virtual std::string get_vhost_http_mount(std::string vhost);
271 virtual std::string get_vhost_http_dir(std::string vhost); 271 virtual std::string get_vhost_http_dir(std::string vhost);
  272 +// setter in memory
  273 +public:
  274 + virtual void set_atc(std::string vhost, bool atc);
272 }; 275 };
273 276
274 /** 277 /**
@@ -822,6 +822,14 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata) @@ -822,6 +822,14 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata)
822 } 822 }
823 } 823 }
824 824
  825 + // if bravo-atc, open atc for vhost.
  826 + if ((prop = metadata->metadata->get_property("bravo_atc")) != NULL) {
  827 + if (prop->is_string() && prop->to_str() == "true") {
  828 + atc = true;
  829 + _srs_config->set_atc(_req->vhost, true);
  830 + }
  831 + }
  832 +
825 // encode the metadata to payload 833 // encode the metadata to payload
826 int size = 0; 834 int size = 0;
827 char* payload = NULL; 835 char* payload = NULL;
@@ -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 "82" 34 +#define VERSION_REVISION "83"
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"