mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
alias http_stream to http_server. rename http to http_static of vhost. rename http_flv to http_renux
This commit is contained in:
parent
7305fa6f03
commit
25807298ad
16 changed files with 104 additions and 67 deletions
|
@ -9,7 +9,7 @@ http_api {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 1985;
|
listen 1985;
|
||||||
}
|
}
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ http_api {
|
||||||
listen 1985;
|
listen 1985;
|
||||||
}
|
}
|
||||||
|
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
|
|
|
@ -120,7 +120,7 @@ http_api {
|
||||||
# which will show srs version and welcome to srs.
|
# which will show srs version and welcome to srs.
|
||||||
# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__
|
# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__
|
||||||
# need to open the feature http of vhost.
|
# need to open the feature http of vhost.
|
||||||
http_stream {
|
http_server {
|
||||||
# whether http streaming service is enabled.
|
# whether http streaming service is enabled.
|
||||||
# default: off
|
# default: off
|
||||||
enabled on;
|
enabled on;
|
||||||
|
@ -355,7 +355,7 @@ vhost http.static.srs.com {
|
||||||
# the variables:
|
# the variables:
|
||||||
# [vhost] current vhost for http server.
|
# [vhost] current vhost for http server.
|
||||||
# @remark the [vhost] is optional, used to mount at specified vhost.
|
# @remark the [vhost] is optional, used to mount at specified vhost.
|
||||||
# @remark the http of __defaultVhost__ will override the http_stream section.
|
# @remark the http of __defaultVhost__ will override the http_server section.
|
||||||
# for example:
|
# for example:
|
||||||
# mount to [vhost]/
|
# mount to [vhost]/
|
||||||
# access by http://ossrs.net:8080/xxx.html
|
# access by http://ossrs.net:8080/xxx.html
|
||||||
|
@ -367,7 +367,7 @@ vhost http.static.srs.com {
|
||||||
# mount to /hls
|
# mount to /hls
|
||||||
# access by http://ossrs.net:8080/hls/xxx.html
|
# access by http://ossrs.net:8080/hls/xxx.html
|
||||||
# or by http://192.168.1.173:8080/hls/xxx.html
|
# or by http://192.168.1.173:8080/hls/xxx.html
|
||||||
# @remark the port of http is specified by http_stream section.
|
# @remark the port of http is specified by http_server section.
|
||||||
# default: [vhost]/
|
# default: [vhost]/
|
||||||
mount [vhost]/hls;
|
mount [vhost]/hls;
|
||||||
# main dir of vhost,
|
# main dir of vhost,
|
||||||
|
@ -378,9 +378,9 @@ vhost http.static.srs.com {
|
||||||
}
|
}
|
||||||
|
|
||||||
# vhost for http flv/aac/mp3 live stream for each vhost.
|
# vhost for http flv/aac/mp3 live stream for each vhost.
|
||||||
vhost http.flv.srs.com {
|
vhost http.remux.srs.com {
|
||||||
# http flv/mp3/aac stream vhost specified config
|
# http flv/mp3/aac stream vhost specified config
|
||||||
http_flv {
|
http_remux {
|
||||||
# whether enable the http flv live streaming service for vhost.
|
# whether enable the http flv live streaming service for vhost.
|
||||||
# default: off
|
# default: off
|
||||||
enabled on;
|
enabled on;
|
||||||
|
@ -410,7 +410,7 @@ vhost http.flv.srs.com {
|
||||||
# access by http://ossrs.net:8080/live/livestream.mp3
|
# access by http://ossrs.net:8080/live/livestream.mp3
|
||||||
# mount to [vhost]/[app]/[stream].aac
|
# mount to [vhost]/[app]/[stream].aac
|
||||||
# access by http://ossrs.net:8080/live/livestream.aac
|
# access by http://ossrs.net:8080/live/livestream.aac
|
||||||
# @remark the port of http is specified by http_stream section.
|
# @remark the port of http is specified by http_server section.
|
||||||
# default: [vhost]/[app]/[stream].flv
|
# default: [vhost]/[app]/[stream].flv
|
||||||
mount [vhost]/[app]/[stream].flv;
|
mount [vhost]/[app]/[stream].flv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
max_connections 1000;
|
max_connections 1000;
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
}
|
}
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
http_flv {
|
http_remux {
|
||||||
enabled on;
|
enabled on;
|
||||||
fast_cache 30;
|
fast_cache 30;
|
||||||
mount [vhost]/[app]/[stream].aac;
|
mount [vhost]/[app]/[stream].aac;
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
max_connections 1000;
|
max_connections 1000;
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
}
|
}
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
http_flv {
|
http_remux {
|
||||||
enabled on;
|
enabled on;
|
||||||
mount [vhost]/[app]/[stream].flv;
|
mount [vhost]/[app]/[stream].flv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
max_connections 1000;
|
max_connections 1000;
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
max_connections 1000;
|
max_connections 1000;
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
}
|
}
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
http_flv {
|
http_remux {
|
||||||
enabled on;
|
enabled on;
|
||||||
fast_cache 30;
|
fast_cache 30;
|
||||||
mount [vhost]/[app]/[stream].mp3;
|
mount [vhost]/[app]/[stream].mp3;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
max_connections 1000;
|
max_connections 1000;
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
|
|
|
@ -9,7 +9,7 @@ http_api {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 1985;
|
listen 1985;
|
||||||
}
|
}
|
||||||
http_stream {
|
http_server {
|
||||||
enabled on;
|
enabled on;
|
||||||
listen 8080;
|
listen 8080;
|
||||||
dir ./objs/nginx/html;
|
dir ./objs/nginx/html;
|
||||||
|
|
|
@ -606,7 +606,16 @@ int SrsConfig::reload_http_stream(SrsConfDirective* old_root)
|
||||||
// ENABLED => ENABLED (modified)
|
// ENABLED => ENABLED (modified)
|
||||||
|
|
||||||
SrsConfDirective* new_http_stream = root->get("http_stream");
|
SrsConfDirective* new_http_stream = root->get("http_stream");
|
||||||
|
// http_stream rename to http_server in SRS2.
|
||||||
|
if (!new_http_stream) {
|
||||||
|
new_http_stream = root->get("http_server");
|
||||||
|
}
|
||||||
|
|
||||||
SrsConfDirective* old_http_stream = old_root->get("http_stream");
|
SrsConfDirective* old_http_stream = old_root->get("http_stream");
|
||||||
|
// http_stream rename to http_server in SRS2.
|
||||||
|
if (!old_http_stream) {
|
||||||
|
old_http_stream = root->get("http_server");
|
||||||
|
}
|
||||||
|
|
||||||
// DISABLED => ENABLED
|
// DISABLED => ENABLED
|
||||||
if (!get_http_stream_enabled(old_http_stream) && get_http_stream_enabled(new_http_stream)) {
|
if (!get_http_stream_enabled(old_http_stream) && get_http_stream_enabled(new_http_stream)) {
|
||||||
|
@ -876,16 +885,28 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
||||||
}
|
}
|
||||||
srs_trace("vhost %s reload http success.", vhost.c_str());
|
srs_trace("vhost %s reload http success.", vhost.c_str());
|
||||||
}
|
}
|
||||||
// http_flv, only one per vhost.
|
// http_static, only one per vhost.
|
||||||
if (!srs_directive_equals(new_vhost->get("http_flv"), old_vhost->get("http_flv"))) {
|
// @remark, http_static introduced as alias of http.
|
||||||
|
if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) {
|
||||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||||
ISrsReloadHandler* subscribe = *it;
|
ISrsReloadHandler* subscribe = *it;
|
||||||
if ((ret = subscribe->on_reload_vhost_http_flv_updated()) != ERROR_SUCCESS) {
|
if ((ret = subscribe->on_reload_vhost_http_updated()) != ERROR_SUCCESS) {
|
||||||
srs_error("vhost %s notify subscribes http_flv failed. ret=%d", vhost.c_str(), ret);
|
srs_error("vhost %s notify subscribes http_static failed. ret=%d", vhost.c_str(), ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
srs_trace("vhost %s reload http_flv success.", vhost.c_str());
|
srs_trace("vhost %s reload http_static success.", vhost.c_str());
|
||||||
|
}
|
||||||
|
// http_remux, only one per vhost.
|
||||||
|
if (!srs_directive_equals(new_vhost->get("http_remux"), old_vhost->get("http_remux"))) {
|
||||||
|
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||||
|
ISrsReloadHandler* subscribe = *it;
|
||||||
|
if ((ret = subscribe->on_reload_vhost_http_remux_updated()) != ERROR_SUCCESS) {
|
||||||
|
srs_error("vhost %s notify subscribes http_remux failed. ret=%d", vhost.c_str(), ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
srs_trace("vhost %s reload http_remux success.", vhost.c_str());
|
||||||
}
|
}
|
||||||
// transcode, many per vhost.
|
// transcode, many per vhost.
|
||||||
if ((ret = reload_transcode(new_vhost, old_vhost)) != ERROR_SUCCESS) {
|
if ((ret = reload_transcode(new_vhost, old_vhost)) != ERROR_SUCCESS) {
|
||||||
|
@ -1293,8 +1314,8 @@ int SrsConfig::check_config()
|
||||||
if (n != "listen" && n != "pid" && n != "chunk_size" && n != "ff_log_dir"
|
if (n != "listen" && n != "pid" && n != "chunk_size" && n != "ff_log_dir"
|
||||||
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_file"
|
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_file"
|
||||||
&& n != "max_connections" && n != "daemon" && n != "heartbeat"
|
&& n != "max_connections" && n != "daemon" && n != "heartbeat"
|
||||||
&& n != "http_api" && n != "http_stream" && n != "stats" && n != "vhost"
|
&& n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print"
|
||||||
&& n != "pithy_print")
|
&& n != "http_stream" && n != "http_server")
|
||||||
{
|
{
|
||||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||||
srs_error("unsupported directive %s, ret=%d", n.c_str(), ret);
|
srs_error("unsupported directive %s, ret=%d", n.c_str(), ret);
|
||||||
|
@ -1367,7 +1388,7 @@ int SrsConfig::check_config()
|
||||||
string n = conf->name;
|
string n = conf->name;
|
||||||
if (n != "enabled" && n != "chunk_size"
|
if (n != "enabled" && n != "chunk_size"
|
||||||
&& n != "mode" && n != "origin" && n != "token_traverse"
|
&& n != "mode" && n != "origin" && n != "token_traverse"
|
||||||
&& n != "dvr" && n != "ingest" && n != "http" && n != "hls" && n != "http_hooks"
|
&& n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks"
|
||||||
&& n != "gop_cache" && n != "queue_length"
|
&& n != "gop_cache" && n != "queue_length"
|
||||||
&& n != "refer" && n != "refer_publish" && n != "refer_play"
|
&& n != "refer" && n != "refer_publish" && n != "refer_play"
|
||||||
&& n != "forward" && n != "transcode" && n != "bandcheck"
|
&& n != "forward" && n != "transcode" && n != "bandcheck"
|
||||||
|
@ -1375,7 +1396,8 @@ int SrsConfig::check_config()
|
||||||
&& n != "atc" && n != "atc_auto"
|
&& n != "atc" && n != "atc_auto"
|
||||||
&& n != "debug_srs_upnode"
|
&& n != "debug_srs_upnode"
|
||||||
&& n != "mr" && n != "mw_latency" && n != "min_latency"
|
&& n != "mr" && n != "mw_latency" && n != "min_latency"
|
||||||
&& n != "security" && n != "http_flv"
|
&& n != "security" && n != "http_remux"
|
||||||
|
&& n != "http" && n != "http_static"
|
||||||
) {
|
) {
|
||||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||||
srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
|
srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
|
||||||
|
@ -1414,7 +1436,7 @@ int SrsConfig::check_config()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (n == "http") {
|
} else if (n == "http" || n == "http_static") {
|
||||||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||||
string m = conf->at(j)->name.c_str();
|
string m = conf->at(j)->name.c_str();
|
||||||
if (m != "enabled" && m != "mount" && m != "dir") {
|
if (m != "enabled" && m != "mount" && m != "dir") {
|
||||||
|
@ -1423,12 +1445,12 @@ int SrsConfig::check_config()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (n == "http_flv") {
|
} else if (n == "http_remux") {
|
||||||
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
for (int j = 0; j < (int)conf->directives.size(); j++) {
|
||||||
string m = conf->at(j)->name.c_str();
|
string m = conf->at(j)->name.c_str();
|
||||||
if (m != "enabled" && m != "mount" && m != "fast_cache") {
|
if (m != "enabled" && m != "mount" && m != "fast_cache") {
|
||||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||||
srs_error("unsupported vhost http_flv directive %s, ret=%d", m.c_str(), ret);
|
srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3329,7 +3351,13 @@ bool SrsConfig::get_http_stream_enabled()
|
||||||
|
|
||||||
SrsConfDirective* SrsConfig::get_http_stream()
|
SrsConfDirective* SrsConfig::get_http_stream()
|
||||||
{
|
{
|
||||||
return root->get("http_stream");
|
SrsConfDirective* conf = root->get("http_stream");
|
||||||
|
// http_stream renamed to http_server in SRS2.
|
||||||
|
if (!conf) {
|
||||||
|
conf = root->get("http_server");
|
||||||
|
}
|
||||||
|
|
||||||
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsConfig::get_http_stream_enabled(SrsConfDirective* conf)
|
bool SrsConfig::get_http_stream_enabled(SrsConfDirective* conf)
|
||||||
|
@ -3383,14 +3411,17 @@ string SrsConfig::get_http_stream_dir()
|
||||||
|
|
||||||
bool SrsConfig::get_vhost_http_enabled(string vhost)
|
bool SrsConfig::get_vhost_http_enabled(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* vconf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!vconf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http");
|
SrsConfDirective* conf = vconf->get("http");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return false;
|
conf = vconf->get("http_static");
|
||||||
|
if (!conf) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("enabled");
|
conf = conf->get("enabled");
|
||||||
|
@ -3407,14 +3438,17 @@ bool SrsConfig::get_vhost_http_enabled(string vhost)
|
||||||
|
|
||||||
string SrsConfig::get_vhost_http_mount(string vhost)
|
string SrsConfig::get_vhost_http_mount(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* vconf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!vconf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_MOUNT;
|
return SRS_CONF_DEFAULT_HTTP_MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http");
|
SrsConfDirective* conf = vconf->get("http");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_MOUNT;
|
conf = vconf->get("http_static");
|
||||||
|
if (!conf) {
|
||||||
|
return SRS_CONF_DEFAULT_HTTP_MOUNT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("mount");
|
conf = conf->get("mount");
|
||||||
|
@ -3427,14 +3461,17 @@ string SrsConfig::get_vhost_http_mount(string vhost)
|
||||||
|
|
||||||
string SrsConfig::get_vhost_http_dir(string vhost)
|
string SrsConfig::get_vhost_http_dir(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* vconf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!vconf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_DIR;
|
return SRS_CONF_DEFAULT_HTTP_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http");
|
SrsConfDirective* conf = vconf->get("http");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_DIR;
|
conf = vconf->get("http_static");
|
||||||
|
if (!conf) {
|
||||||
|
return SRS_CONF_DEFAULT_HTTP_DIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("dir");
|
conf = conf->get("dir");
|
||||||
|
@ -3445,14 +3482,14 @@ string SrsConfig::get_vhost_http_dir(string vhost)
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsConfig::get_vhost_http_flv_enabled(string vhost)
|
bool SrsConfig::get_vhost_http_remux_enabled(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http_flv");
|
conf = conf->get("http_remux");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3469,14 +3506,14 @@ bool SrsConfig::get_vhost_http_flv_enabled(string vhost)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double SrsConfig::get_vhost_http_flv_fast_cache(string vhost)
|
double SrsConfig::get_vhost_http_remux_fast_cache(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE;
|
return SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http_flv");
|
conf = conf->get("http_remux");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE;
|
return SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE;
|
||||||
}
|
}
|
||||||
|
@ -3493,21 +3530,21 @@ double SrsConfig::get_vhost_http_flv_fast_cache(string vhost)
|
||||||
return ::atof(conf->arg0().c_str());
|
return ::atof(conf->arg0().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
string SrsConfig::get_vhost_http_flv_mount(string vhost)
|
string SrsConfig::get_vhost_http_remux_mount(string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_FLV_MOUNT;
|
return SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("http_flv");
|
conf = conf->get("http_remux");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_FLV_MOUNT;
|
return SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("mount");
|
conf = conf->get("mount");
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return SRS_CONF_DEFAULT_HTTP_FLV_MOUNT;
|
return SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf->arg0();
|
return conf->arg0();
|
||||||
|
|
|
@ -66,7 +66,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000
|
#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000
|
||||||
|
|
||||||
#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/"
|
#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/"
|
||||||
#define SRS_CONF_DEFAULT_HTTP_FLV_MOUNT "[vhost]/[app]/[stream].flv"
|
#define SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT "[vhost]/[app]/[stream].flv"
|
||||||
#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH
|
#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH
|
||||||
#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 30
|
#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 30
|
||||||
|
|
||||||
|
@ -970,16 +970,16 @@ public:
|
||||||
/**
|
/**
|
||||||
* get whether vhost enabled http flv live stream
|
* get whether vhost enabled http flv live stream
|
||||||
*/
|
*/
|
||||||
virtual bool get_vhost_http_flv_enabled(std::string vhost);
|
virtual bool get_vhost_http_remux_enabled(std::string vhost);
|
||||||
/**
|
/**
|
||||||
* get the fast cache duration for http audio live stream.
|
* get the fast cache duration for http audio live stream.
|
||||||
*/
|
*/
|
||||||
virtual double get_vhost_http_flv_fast_cache(std::string vhost);
|
virtual double get_vhost_http_remux_fast_cache(std::string vhost);
|
||||||
/**
|
/**
|
||||||
* get the http flv live stream mount point for vhost.
|
* get the http flv live stream mount point for vhost.
|
||||||
* used to generate the flv stream mount path.
|
* used to generate the flv stream mount path.
|
||||||
*/
|
*/
|
||||||
virtual std::string get_vhost_http_flv_mount(std::string vhost);
|
virtual std::string get_vhost_http_remux_mount(std::string vhost);
|
||||||
// http heartbeart section
|
// http heartbeart section
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ int SrsVodStream::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset > fs.filesize()) {
|
if (offset > fs.filesize()) {
|
||||||
ret = ERROR_HTTP_FLV_OFFSET_OVERFLOW;
|
ret = ERROR_HTTP_REMUX_OFFSET_OVERFLOW;
|
||||||
srs_warn("http flv streaming %s overflow. size=%"PRId64", offset=%d, ret=%d",
|
srs_warn("http flv streaming %s overflow. size=%"PRId64", offset=%d, ret=%d",
|
||||||
fullpath.c_str(), fs.filesize(), offset, ret);
|
fullpath.c_str(), fs.filesize(), offset, ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -100,7 +100,7 @@ int SrsVodStream::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (sh_size <= 0) {
|
if (sh_size <= 0) {
|
||||||
ret = ERROR_HTTP_FLV_SEQUENCE_HEADER;
|
ret = ERROR_HTTP_REMUX_SEQUENCE_HEADER;
|
||||||
srs_warn("http flv streaming no sequence header. size=%d, ret=%d", sh_size, ret);
|
srs_warn("http flv streaming no sequence header. size=%d, ret=%d", sh_size, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ int SrsStreamCache::dump_cache(SrsConsumer* consumer)
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("http: dump cache %d msgs, duration=%dms, cache=%.2fs",
|
srs_trace("http: dump cache %d msgs, duration=%dms, cache=%.2fs",
|
||||||
queue->size(), queue->duration(), _srs_config->get_vhost_http_flv_fast_cache(req->vhost));
|
queue->size(), queue->duration(), _srs_config->get_vhost_http_remux_fast_cache(req->vhost));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ int SrsStreamCache::cycle()
|
||||||
// TODO: FIMXE: add pithy print.
|
// TODO: FIMXE: add pithy print.
|
||||||
|
|
||||||
// TODO: FIXME: support reload.
|
// TODO: FIXME: support reload.
|
||||||
queue->set_queue_size(_srs_config->get_vhost_http_flv_fast_cache(req->vhost));
|
queue->set_queue_size(_srs_config->get_vhost_http_remux_fast_cache(req->vhost));
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// get messages from consumer.
|
// get messages from consumer.
|
||||||
|
@ -656,7 +656,7 @@ int SrsHttpServer::on_reload_vhost_http_updated()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsHttpServer::on_reload_vhost_http_flv_updated()
|
int SrsHttpServer::on_reload_vhost_http_remux_updated()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
// TODO: FIXME: implements it.
|
// TODO: FIXME: implements it.
|
||||||
|
@ -737,13 +737,13 @@ int SrsHttpServer::mount_flv_streaming()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string vhost = conf->arg0();
|
std::string vhost = conf->arg0();
|
||||||
if (!_srs_config->get_vhost_http_flv_enabled(vhost)) {
|
if (!_srs_config->get_vhost_http_remux_enabled(vhost)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsLiveEntry* entry = new SrsLiveEntry();
|
SrsLiveEntry* entry = new SrsLiveEntry();
|
||||||
entry->vhost = vhost;
|
entry->vhost = vhost;
|
||||||
entry->mount = _srs_config->get_vhost_http_flv_mount(vhost);
|
entry->mount = _srs_config->get_vhost_http_remux_mount(vhost);
|
||||||
flvs[vhost] = entry;
|
flvs[vhost] = entry;
|
||||||
srs_trace("http flv live stream, vhost=%s, mount=%s",
|
srs_trace("http flv live stream, vhost=%s, mount=%s",
|
||||||
vhost.c_str(), entry->mount.c_str());
|
vhost.c_str(), entry->mount.c_str());
|
||||||
|
|
|
@ -259,7 +259,7 @@ public:
|
||||||
// interface ISrsThreadHandler.
|
// interface ISrsThreadHandler.
|
||||||
public:
|
public:
|
||||||
virtual int on_reload_vhost_http_updated();
|
virtual int on_reload_vhost_http_updated();
|
||||||
virtual int on_reload_vhost_http_flv_updated();
|
virtual int on_reload_vhost_http_remux_updated();
|
||||||
private:
|
private:
|
||||||
virtual int mount_static_file();
|
virtual int mount_static_file();
|
||||||
virtual int mount_flv_streaming();
|
virtual int mount_flv_streaming();
|
||||||
|
|
|
@ -95,7 +95,7 @@ int ISrsReloadHandler::on_reload_vhost_http_updated()
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ISrsReloadHandler::on_reload_vhost_http_flv_updated()
|
int ISrsReloadHandler::on_reload_vhost_http_remux_updated()
|
||||||
{
|
{
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
virtual int on_reload_http_stream_disabled();
|
virtual int on_reload_http_stream_disabled();
|
||||||
virtual int on_reload_http_stream_updated();
|
virtual int on_reload_http_stream_updated();
|
||||||
virtual int on_reload_vhost_http_updated();
|
virtual int on_reload_vhost_http_updated();
|
||||||
virtual int on_reload_vhost_http_flv_updated();
|
virtual int on_reload_vhost_http_remux_updated();
|
||||||
virtual int on_reload_vhost_added(std::string vhost);
|
virtual int on_reload_vhost_added(std::string vhost);
|
||||||
virtual int on_reload_vhost_removed(std::string vhost);
|
virtual int on_reload_vhost_removed(std::string vhost);
|
||||||
virtual int on_reload_vhost_atc(std::string vhost);
|
virtual int on_reload_vhost_atc(std::string vhost);
|
||||||
|
|
|
@ -166,8 +166,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define ERROR_HTTP_HANDLER_MATCH_URL 3010
|
#define ERROR_HTTP_HANDLER_MATCH_URL 3010
|
||||||
#define ERROR_HTTP_HANDLER_INVALID 3011
|
#define ERROR_HTTP_HANDLER_INVALID 3011
|
||||||
#define ERROR_HTTP_API_LOGS 3012
|
#define ERROR_HTTP_API_LOGS 3012
|
||||||
#define ERROR_HTTP_FLV_SEQUENCE_HEADER 3013
|
#define ERROR_HTTP_REMUX_SEQUENCE_HEADER 3013
|
||||||
#define ERROR_HTTP_FLV_OFFSET_OVERFLOW 3014
|
#define ERROR_HTTP_REMUX_OFFSET_OVERFLOW 3014
|
||||||
#define ERROR_ENCODER_VCODEC 3015
|
#define ERROR_ENCODER_VCODEC 3015
|
||||||
#define ERROR_ENCODER_OUTPUT 3016
|
#define ERROR_ENCODER_OUTPUT 3016
|
||||||
#define ERROR_ENCODER_ACHANNELS 3017
|
#define ERROR_ENCODER_ACHANNELS 3017
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue