winlin

add atc_auto to disable or enable auto detect atc

... ... @@ -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
... ...
... ... @@ -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);
... ...
... ... @@ -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);
... ...
... ... @@ -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;
}
}
}
... ...
... ... @@ -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"
... ...