mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add utest for config vhosts, transcode/dvr/hls
This commit is contained in:
parent
d612597a8f
commit
2c9e16a9e7
6 changed files with 3222 additions and 1152 deletions
|
@ -1630,7 +1630,7 @@ SrsConfDirective* SrsConfig::get_forward(string vhost)
|
|||
return conf->get("forward");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
||||
SrsConfDirective* SrsConfig::get_vhost_http_hooks(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
||||
|
@ -1638,13 +1638,30 @@ SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
return conf->get("http_hooks");
|
||||
}
|
||||
|
||||
bool SrsConfig::get_vhost_http_hooks_enabled(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1653,127 +1670,67 @@ SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
|||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_close");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_publish");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_unpublish");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_play");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_stop");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conf = conf->get("http_hooks");
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrsConfDirective* enabled = conf->get("enabled");
|
||||
if (!enabled || enabled->arg0() != "on") {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_dvr_hss_reap_flv");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue