mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #319, support query the vhost info.
This commit is contained in:
parent
bdfd0ae09e
commit
a79e19599c
3 changed files with 716 additions and 151 deletions
|
@ -49,6 +49,11 @@ daemon on;
|
||||||
# if on, use gmtime() instead, which use UTC time.
|
# if on, use gmtime() instead, which use UTC time.
|
||||||
# default: off
|
# default: off
|
||||||
utc_time off;
|
utc_time off;
|
||||||
|
# config for the pithy print,
|
||||||
|
# which always print constant message specified by interval,
|
||||||
|
# whatever the clients in concurrency.
|
||||||
|
# default: 10000
|
||||||
|
pithy_print_ms 10000;
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
# heartbeat/stats sections
|
# heartbeat/stats sections
|
||||||
|
@ -998,6 +1003,92 @@ vhost exec.srs.com {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# vhost for bandwidth check
|
||||||
|
# generally, the bandcheck vhost must be: bandcheck.srs.com,
|
||||||
|
# or need to modify the vhost of client.
|
||||||
|
vhost bandcheck.srs.com {
|
||||||
|
enabled on;
|
||||||
|
chunk_size 65000;
|
||||||
|
# bandwidth check config.
|
||||||
|
bandcheck {
|
||||||
|
# whether support bandwidth check,
|
||||||
|
# default: off.
|
||||||
|
enabled on;
|
||||||
|
# the key for server to valid,
|
||||||
|
# if invalid key, server disconnect and abort the bandwidth check.
|
||||||
|
key "35c9b402c12a7246868752e2878f7e0e";
|
||||||
|
# the interval in seconds for bandwidth check,
|
||||||
|
# server donot allow new test request.
|
||||||
|
# default: 30
|
||||||
|
interval 30;
|
||||||
|
# the max available check bandwidth in kbps.
|
||||||
|
# to avoid attack of bandwidth check.
|
||||||
|
# default: 1000
|
||||||
|
limit_kbps 4000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# set the chunk size of vhost.
|
||||||
|
vhost chunksize.srs.com {
|
||||||
|
# the default chunk size is 128, max is 65536,
|
||||||
|
# some client does not support chunk size change,
|
||||||
|
# vhost chunk size will override the global value.
|
||||||
|
# default: global chunk size.
|
||||||
|
chunk_size 128;
|
||||||
|
}
|
||||||
|
|
||||||
|
# vhost for time jitter
|
||||||
|
vhost jitter.srs.com {
|
||||||
|
# about the stream monotonically increasing:
|
||||||
|
# 1. video timestamp is monotonically increasing,
|
||||||
|
# 2. audio timestamp is monotonically increasing,
|
||||||
|
# 3. video and audio timestamp is interleaved/mixed monotonically increasing.
|
||||||
|
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
|
||||||
|
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
|
||||||
|
# the time jitter algorithm:
|
||||||
|
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
|
||||||
|
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
|
||||||
|
# 3. off, disable the time jitter algorithm, like atc.
|
||||||
|
# default: full
|
||||||
|
time_jitter full;
|
||||||
|
# whether use the interleaved/mixed algorithm to correct the timestamp.
|
||||||
|
# if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
|
||||||
|
# if off, use time_jitter to correct the timestamp if required.
|
||||||
|
# default: off
|
||||||
|
mix_correct off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# vhost for atc.
|
||||||
|
vhost atc.srs.com {
|
||||||
|
# vhost for atc for hls/hds/rtmp backup.
|
||||||
|
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
|
||||||
|
# when atc is on, server delivery rtmp stream by absolute time.
|
||||||
|
# atc is used, for instance, encoder will copy stream to master and slave server,
|
||||||
|
# server use atc to delivery stream to edge/client, where stream time from master/slave server
|
||||||
|
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
|
||||||
|
# if the time not the same, the HLS stream cannot slice to support system backup.
|
||||||
|
#
|
||||||
|
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
|
||||||
|
# @see http://www.baidu.com/#wd=hds%20hls%20atc
|
||||||
|
#
|
||||||
|
# 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
# the vhost disabled.
|
||||||
|
vhost removed.srs.com {
|
||||||
|
# whether the vhost is enabled.
|
||||||
|
# if off, all request access denied.
|
||||||
|
# default: on
|
||||||
|
enabled off;
|
||||||
|
}
|
||||||
|
|
||||||
# the main comments for transcode
|
# the main comments for transcode
|
||||||
vhost example.transcode.srs.com {
|
vhost example.transcode.srs.com {
|
||||||
# the streaming transcode configs.
|
# the streaming transcode configs.
|
||||||
|
@ -1441,95 +1532,3 @@ vhost stream.transcode.srs.com {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# vhost for bandwidth check
|
|
||||||
# generally, the bandcheck vhost must be: bandcheck.srs.com,
|
|
||||||
# or need to modify the vhost of client.
|
|
||||||
vhost bandcheck.srs.com {
|
|
||||||
enabled on;
|
|
||||||
chunk_size 65000;
|
|
||||||
# bandwidth check config.
|
|
||||||
bandcheck {
|
|
||||||
# whether support bandwidth check,
|
|
||||||
# default: off.
|
|
||||||
enabled on;
|
|
||||||
# the key for server to valid,
|
|
||||||
# if invalid key, server disconnect and abort the bandwidth check.
|
|
||||||
key "35c9b402c12a7246868752e2878f7e0e";
|
|
||||||
# the interval in seconds for bandwidth check,
|
|
||||||
# server donot allow new test request.
|
|
||||||
# default: 30
|
|
||||||
interval 30;
|
|
||||||
# the max available check bandwidth in kbps.
|
|
||||||
# to avoid attack of bandwidth check.
|
|
||||||
# default: 1000
|
|
||||||
limit_kbps 4000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# set the chunk size of vhost.
|
|
||||||
vhost chunksize.srs.com {
|
|
||||||
# the default chunk size is 128, max is 65536,
|
|
||||||
# some client does not support chunk size change,
|
|
||||||
# vhost chunk size will override the global value.
|
|
||||||
# default: global chunk size.
|
|
||||||
chunk_size 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
# vhost for time jitter
|
|
||||||
vhost jitter.srs.com {
|
|
||||||
# about the stream monotonically increasing:
|
|
||||||
# 1. video timestamp is monotonically increasing,
|
|
||||||
# 2. audio timestamp is monotonically increasing,
|
|
||||||
# 3. video and audio timestamp is interleaved/mixed monotonically increasing.
|
|
||||||
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
|
|
||||||
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
|
|
||||||
# the time jitter algorithm:
|
|
||||||
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
|
|
||||||
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
|
|
||||||
# 3. off, disable the time jitter algorithm, like atc.
|
|
||||||
# default: full
|
|
||||||
time_jitter full;
|
|
||||||
# whether use the interleaved/mixed algorithm to correct the timestamp.
|
|
||||||
# if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
|
|
||||||
# if off, use time_jitter to correct the timestamp if required.
|
|
||||||
# default: off
|
|
||||||
mix_correct off;
|
|
||||||
}
|
|
||||||
|
|
||||||
# vhost for atc.
|
|
||||||
vhost atc.srs.com {
|
|
||||||
# vhost for atc for hls/hds/rtmp backup.
|
|
||||||
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
|
|
||||||
# when atc is on, server delivery rtmp stream by absolute time.
|
|
||||||
# atc is used, for instance, encoder will copy stream to master and slave server,
|
|
||||||
# server use atc to delivery stream to edge/client, where stream time from master/slave server
|
|
||||||
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
|
|
||||||
# if the time not the same, the HLS stream cannot slice to support system backup.
|
|
||||||
#
|
|
||||||
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
|
|
||||||
# @see http://www.baidu.com/#wd=hds%20hls%20atc
|
|
||||||
#
|
|
||||||
# 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
# the vhost disabled.
|
|
||||||
vhost removed.srs.com {
|
|
||||||
# whether the vhost is enabled.
|
|
||||||
# if off, all request access denied.
|
|
||||||
# default: on
|
|
||||||
enabled off;
|
|
||||||
}
|
|
||||||
|
|
||||||
# config for the pithy print,
|
|
||||||
# which always print constant message specified by interval,
|
|
||||||
# whatever the clients in concurrency.
|
|
||||||
# default: 10000
|
|
||||||
pithy_print_ms 10000;
|
|
||||||
|
|
320
trunk/conf/full.one.vhost.conf
Normal file
320
trunk/conf/full.one.vhost.conf
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
listen 1935;
|
||||||
|
pid ./objs/srs.pid;
|
||||||
|
chunk_size 60000;
|
||||||
|
ff_log_dir ./objs;
|
||||||
|
srs_log_tank console;
|
||||||
|
srs_log_level trace;
|
||||||
|
srs_log_file ./objs/srs.log;
|
||||||
|
max_connections 1000;
|
||||||
|
daemon off;
|
||||||
|
utc_time off;
|
||||||
|
pithy_print_ms 10000;
|
||||||
|
heartbeat {
|
||||||
|
enabled off;
|
||||||
|
interval 9.3;
|
||||||
|
url http://127.0.0.1:8085/api/v1/servers;
|
||||||
|
device_id my-srs-device;
|
||||||
|
summaries off;
|
||||||
|
}
|
||||||
|
stats {
|
||||||
|
network 0;
|
||||||
|
disk sda sdb xvda xvdb;
|
||||||
|
}
|
||||||
|
http_api {
|
||||||
|
enabled on;
|
||||||
|
listen 1985;
|
||||||
|
crossdomain on;
|
||||||
|
raw_api {
|
||||||
|
enabled on;
|
||||||
|
allow_reload on;
|
||||||
|
allow_query on;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http_server {
|
||||||
|
enabled off;
|
||||||
|
listen 8080;
|
||||||
|
dir ./objs/nginx/html;
|
||||||
|
}
|
||||||
|
stream_caster {
|
||||||
|
enabled off;
|
||||||
|
caster mpegts_over_udp;
|
||||||
|
output rtmp://127.0.0.1/live/livestream;
|
||||||
|
listen 8935;
|
||||||
|
rtp_port_min 57200;
|
||||||
|
rtp_port_max 57300;
|
||||||
|
}
|
||||||
|
stream_caster {
|
||||||
|
enabled off;
|
||||||
|
caster mpegts_over_udp;
|
||||||
|
output rtmp://127.0.0.1/live/livestream;
|
||||||
|
listen 8935;
|
||||||
|
}
|
||||||
|
stream_caster {
|
||||||
|
enabled off;
|
||||||
|
caster rtsp;
|
||||||
|
output rtmp://127.0.0.1/[app]/[stream];
|
||||||
|
listen 554;
|
||||||
|
rtp_port_min 57200;
|
||||||
|
rtp_port_max 57300;
|
||||||
|
}
|
||||||
|
stream_caster {
|
||||||
|
enabled off;
|
||||||
|
caster flv;
|
||||||
|
output rtmp://127.0.0.1/[app]/[stream];
|
||||||
|
listen 8936;
|
||||||
|
}
|
||||||
|
vhost __defaultVhost__ {
|
||||||
|
}
|
||||||
|
vhost vhost.srs.com {
|
||||||
|
enabled off;
|
||||||
|
|
||||||
|
mode remote;
|
||||||
|
origin 127.0.0.1:1935 localhost:1935;
|
||||||
|
token_traverse off;
|
||||||
|
vhost same.edge.srs.com;
|
||||||
|
|
||||||
|
forward 127.0.0.1:1936 127.0.0.1:1937;
|
||||||
|
|
||||||
|
debug_srs_upnode off;
|
||||||
|
|
||||||
|
chunk_size 128;
|
||||||
|
|
||||||
|
time_jitter full;
|
||||||
|
mix_correct off;
|
||||||
|
|
||||||
|
atc on;
|
||||||
|
atc_auto on;
|
||||||
|
|
||||||
|
min_latency on;
|
||||||
|
mr {
|
||||||
|
enabled off;
|
||||||
|
}
|
||||||
|
mw_latency 100;
|
||||||
|
gop_cache off;
|
||||||
|
queue_length 10;
|
||||||
|
tcp_nodelay on;
|
||||||
|
send_min_interval 10.0;
|
||||||
|
reduce_sequence_header on;
|
||||||
|
publish_1stpkt_timeout 20000;
|
||||||
|
publish_normal_timeout 7000;
|
||||||
|
|
||||||
|
refer github.com github.io;
|
||||||
|
refer_publish github.com github.io;
|
||||||
|
refer_play github.com github.io;
|
||||||
|
|
||||||
|
bandcheck {
|
||||||
|
enabled off;
|
||||||
|
key 35c9b402c12a7246868752e2878f7e0e;
|
||||||
|
interval 30;
|
||||||
|
limit_kbps 4000;
|
||||||
|
}
|
||||||
|
|
||||||
|
security {
|
||||||
|
enabled off;
|
||||||
|
allow play all;
|
||||||
|
allow publish all;
|
||||||
|
}
|
||||||
|
|
||||||
|
http_static {
|
||||||
|
enabled off;
|
||||||
|
mount [vhost]/hls;
|
||||||
|
dir ./objs/nginx/html/hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
http_remux {
|
||||||
|
enabled off;
|
||||||
|
fast_cache 30;
|
||||||
|
mount [vhost]/[app]/[stream].flv;
|
||||||
|
hstrs on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http_hooks {
|
||||||
|
enabled off;
|
||||||
|
on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
|
||||||
|
on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
|
||||||
|
on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
|
||||||
|
on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
|
||||||
|
on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
|
||||||
|
on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
|
||||||
|
on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
|
||||||
|
on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls;
|
||||||
|
on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url];
|
||||||
|
}
|
||||||
|
|
||||||
|
hls {
|
||||||
|
enabled off;
|
||||||
|
hls_fragment 10;
|
||||||
|
hls_td_ratio 1.5;
|
||||||
|
hls_aof_ratio 2.0;
|
||||||
|
hls_window 60;
|
||||||
|
hls_on_error ignore;
|
||||||
|
hls_storage disk;
|
||||||
|
hls_path ./objs/nginx/html;
|
||||||
|
hls_m3u8_file [app]/[stream].m3u8;
|
||||||
|
hls_ts_file [app]/[stream]-[seq].ts;
|
||||||
|
hls_ts_floor off;
|
||||||
|
hls_entry_prefix http://your-server;
|
||||||
|
hls_mount [vhost]/[app]/[stream].m3u8;
|
||||||
|
hls_acodec aac;
|
||||||
|
hls_vcodec h264;
|
||||||
|
hls_cleanup on;
|
||||||
|
hls_dispose 0;
|
||||||
|
hls_nb_notify 64;
|
||||||
|
hls_wait_keyframe on;
|
||||||
|
}
|
||||||
|
|
||||||
|
hds {
|
||||||
|
enabled off;
|
||||||
|
hds_fragment 10;
|
||||||
|
hds_window 60;
|
||||||
|
hds_path ./objs/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
exec {
|
||||||
|
enabled off;
|
||||||
|
publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
dvr {
|
||||||
|
enabled off;
|
||||||
|
dvr_plan session;
|
||||||
|
dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
|
||||||
|
dvr_duration 30;
|
||||||
|
dvr_wait_keyframe on;
|
||||||
|
time_jitter full;
|
||||||
|
}
|
||||||
|
|
||||||
|
ingest livestream {
|
||||||
|
enabled off;
|
||||||
|
input {
|
||||||
|
type file;
|
||||||
|
url ./doc/source.200kbps.768x320.flv;
|
||||||
|
}
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine {
|
||||||
|
enabled off;
|
||||||
|
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transcode {
|
||||||
|
enabled off;
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine ffsuper {
|
||||||
|
enabled off;
|
||||||
|
iformat flv;
|
||||||
|
vfilter {
|
||||||
|
i ./doc/ffmpeg-logo.png;
|
||||||
|
filter_complex overlay=10:10;
|
||||||
|
}
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 1500;
|
||||||
|
vfps 25;
|
||||||
|
vwidth 768;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 12;
|
||||||
|
vprofile main;
|
||||||
|
vpreset medium;
|
||||||
|
vparams {
|
||||||
|
t 100;
|
||||||
|
coder 1;
|
||||||
|
b_strategy 2;
|
||||||
|
bf 3;
|
||||||
|
refs 10;
|
||||||
|
}
|
||||||
|
acodec libfdk_aac;
|
||||||
|
abitrate 70;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {
|
||||||
|
profile:a aac_low;
|
||||||
|
}
|
||||||
|
oformat flv;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine ffhd {
|
||||||
|
enabled off;
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 1200;
|
||||||
|
vfps 25;
|
||||||
|
vwidth 1382;
|
||||||
|
vheight 576;
|
||||||
|
vthreads 6;
|
||||||
|
vprofile main;
|
||||||
|
vpreset medium;
|
||||||
|
vparams;
|
||||||
|
acodec libfdk_aac;
|
||||||
|
abitrate 70;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine ffsd {
|
||||||
|
enabled off;
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 800;
|
||||||
|
vfps 25;
|
||||||
|
vwidth 1152;
|
||||||
|
vheight 480;
|
||||||
|
vthreads 4;
|
||||||
|
vprofile main;
|
||||||
|
vpreset fast;
|
||||||
|
vparams;
|
||||||
|
acodec libfdk_aac;
|
||||||
|
abitrate 60;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine fffast {
|
||||||
|
enabled off;
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 768;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams;
|
||||||
|
acodec libfdk_aac;
|
||||||
|
abitrate 45;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine vcopy {
|
||||||
|
enabled off;
|
||||||
|
vcodec copy;
|
||||||
|
acodec libfdk_aac;
|
||||||
|
abitrate 45;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine acopy {
|
||||||
|
enabled off;
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 768;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams;
|
||||||
|
acodec copy;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
engine copy {
|
||||||
|
enabled off;
|
||||||
|
vcodec copy;
|
||||||
|
acodec copy;
|
||||||
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1798,27 +1798,62 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
|
|
||||||
SrsConfDirective* dir = NULL;
|
SrsConfDirective* dir = NULL;
|
||||||
|
|
||||||
// security
|
// stat id and name.
|
||||||
if ((dir = vhost->get("security")) != NULL) {
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
SrsAmf0Object* security = SrsAmf0Any::object();
|
|
||||||
obj->set("security", security);
|
|
||||||
|
|
||||||
SrsAmf0StrictArray* allows = SrsAmf0Any::strict_array();
|
SrsStatisticVhost* svhost = stat->find_vhost(vhost->arg0());
|
||||||
security->set("allows", allows);
|
obj->set("id", SrsAmf0Any::number(svhost? (double)svhost->id : 0));
|
||||||
|
|
||||||
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
obj->set("name", vhost->dumps_arg0_to_str());
|
||||||
SrsConfDirective* sdir = dir->directives.at(i);
|
|
||||||
|
|
||||||
if (sdir->name == "enabled") {
|
// enabled
|
||||||
security->set("enabled", sdir->dumps_arg0_to_boolean());
|
if ((dir = vhost->get("enabled")) != NULL) {
|
||||||
} else if (sdir->name == "allow") {
|
obj->set("enabled", dir->dumps_arg0_to_boolean());
|
||||||
SrsAmf0Object* allow = SrsAmf0Any::object();
|
|
||||||
allow->set("action", SrsAmf0Any::str(sdir->name.c_str()));
|
|
||||||
allow->set("method", SrsAmf0Any::str(sdir->arg0().c_str()));
|
|
||||||
allow->set("entry", SrsAmf0Any::str(sdir->arg1().c_str()));
|
|
||||||
allows->append(allow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// edge.
|
||||||
|
if ((dir = vhost->get("mode")) != NULL) {
|
||||||
|
obj->set("mode", dir->dumps_arg0_to_str());
|
||||||
}
|
}
|
||||||
|
if ((dir = vhost->get("origin")) != NULL) {
|
||||||
|
obj->set("origin", dir->dumps_args());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("token_traverse")) != NULL) {
|
||||||
|
obj->set("token_traverse", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("vhost")) != NULL) {
|
||||||
|
obj->set("vhost", dir->dumps_arg0_to_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// forward
|
||||||
|
if ((dir = vhost->get("forward")) != NULL) {
|
||||||
|
obj->set("forward", dir->dumps_args());
|
||||||
|
}
|
||||||
|
|
||||||
|
// debug_srs_upnode
|
||||||
|
if ((dir = vhost->get("debug_srs_upnode")) != NULL) {
|
||||||
|
obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
// chunk_size
|
||||||
|
if ((dir = vhost->get("chunk_size")) != NULL) {
|
||||||
|
obj->set("chunk_size", dir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
|
||||||
|
// time_jitter
|
||||||
|
if ((dir = vhost->get("time_jitter")) != NULL) {
|
||||||
|
obj->set("time_jitter", dir->dumps_arg0_to_str());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("mix_correct")) != NULL) {
|
||||||
|
obj->set("mix_correct", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
// atc
|
||||||
|
if ((dir = vhost->get("atc")) != NULL) {
|
||||||
|
obj->set("atc", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("atc_auto")) != NULL) {
|
||||||
|
obj->set("atc_auto", dir->dumps_arg0_to_boolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
// mrw
|
// mrw
|
||||||
|
@ -1843,18 +1878,223 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
obj->set("mw_latency", dir->dumps_arg0_to_number());
|
obj->set("mw_latency", dir->dumps_arg0_to_number());
|
||||||
}
|
}
|
||||||
|
|
||||||
// edge.
|
// realtime latency
|
||||||
if ((dir = vhost->get("mode")) != NULL) {
|
if ((dir = vhost->get("gop_cache")) != NULL) {
|
||||||
obj->set("mode", dir->dumps_arg0_to_str());
|
obj->set("gop_cache", dir->dumps_arg0_to_boolean());
|
||||||
}
|
}
|
||||||
if ((dir = vhost->get("origin")) != NULL) {
|
if ((dir = vhost->get("queue_length")) != NULL) {
|
||||||
obj->set("origin", dir->dumps_args());
|
obj->set("queue_length", dir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("tcp_nodelay")) != NULL) {
|
||||||
|
obj->set("tcp_nodelay", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
// stream control
|
||||||
|
if ((dir = vhost->get("send_min_interval")) != NULL) {
|
||||||
|
obj->set("send_min_interval", dir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("reduce_sequence_header")) != NULL) {
|
||||||
|
obj->set("reduce_sequence_header", dir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("publish_1stpkt_timeout")) != NULL) {
|
||||||
|
obj->set("publish_1stpkt_timeout", dir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("publish_normal_timeout")) != NULL) {
|
||||||
|
obj->set("publish_normal_timeout", dir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
|
||||||
|
// refer
|
||||||
|
if ((dir = vhost->get("refer")) != NULL) {
|
||||||
|
obj->set("refer", dir->dumps_args());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("refer_publish")) != NULL) {
|
||||||
|
obj->set("refer_publish", dir->dumps_args());
|
||||||
|
}
|
||||||
|
if ((dir = vhost->get("refer_play")) != NULL) {
|
||||||
|
obj->set("refer_play", dir->dumps_args());
|
||||||
|
}
|
||||||
|
|
||||||
|
// bandcheck
|
||||||
|
if ((dir = vhost->get("bandcheck")) != NULL) {
|
||||||
|
SrsAmf0Object* bandcheck = SrsAmf0Any::object();
|
||||||
|
obj->set("bandcheck", bandcheck);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
bandcheck->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "key") {
|
||||||
|
bandcheck->set("key", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "interval") {
|
||||||
|
bandcheck->set("interval", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "limit_kbps") {
|
||||||
|
bandcheck->set("limit_kbps", sdir->dumps_arg0_to_number());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// security
|
||||||
|
if ((dir = vhost->get("security")) != NULL) {
|
||||||
|
SrsAmf0Object* security = SrsAmf0Any::object();
|
||||||
|
obj->set("security", security);
|
||||||
|
|
||||||
|
SrsAmf0StrictArray* allows = SrsAmf0Any::strict_array();
|
||||||
|
security->set("allows", allows);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
security->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "allow") {
|
||||||
|
SrsAmf0Object* allow = SrsAmf0Any::object();
|
||||||
|
allow->set("action", SrsAmf0Any::str(sdir->name.c_str()));
|
||||||
|
allow->set("method", SrsAmf0Any::str(sdir->arg0().c_str()));
|
||||||
|
allow->set("entry", SrsAmf0Any::str(sdir->arg1().c_str()));
|
||||||
|
allows->append(allow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// http_static
|
||||||
|
if ((dir = vhost->get("http_static")) != NULL) {
|
||||||
|
SrsAmf0Object* http_static = SrsAmf0Any::object();
|
||||||
|
obj->set("http_static", http_static);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
http_static->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "mount") {
|
||||||
|
http_static->set("mount", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "dir") {
|
||||||
|
http_static->set("dir", sdir->dumps_arg0_to_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// http_remux
|
||||||
|
if ((dir = vhost->get("http_remux")) != NULL) {
|
||||||
|
SrsAmf0Object* http_remux = SrsAmf0Any::object();
|
||||||
|
obj->set("http_remux", http_remux);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
http_remux->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "fast_cache") {
|
||||||
|
http_remux->set("fast_cache", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "mount") {
|
||||||
|
http_remux->set("mount", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hstrs") {
|
||||||
|
http_remux->set("hstrs", sdir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// http_hooks
|
||||||
|
if ((dir = vhost->get("http_hooks")) != NULL) {
|
||||||
|
SrsAmf0Object* http_hooks = SrsAmf0Any::object();
|
||||||
|
obj->set("http_hooks", http_hooks);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
http_hooks->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "on_connect") {
|
||||||
|
http_hooks->set("on_connect", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_close") {
|
||||||
|
http_hooks->set("on_close", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_publish") {
|
||||||
|
http_hooks->set("on_publish", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_unpublish") {
|
||||||
|
http_hooks->set("on_unpublish", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_play") {
|
||||||
|
http_hooks->set("on_play", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_stop") {
|
||||||
|
http_hooks->set("on_stop", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_dvr") {
|
||||||
|
http_hooks->set("on_dvr", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_hls") {
|
||||||
|
http_hooks->set("on_hls", sdir->dumps_args());
|
||||||
|
} else if (sdir->name == "on_hls_notify") {
|
||||||
|
http_hooks->set("on_hls_notify", sdir->dumps_arg0_to_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hls
|
||||||
|
if ((dir = vhost->get("hls")) != NULL) {
|
||||||
|
SrsAmf0Object* hls = SrsAmf0Any::object();
|
||||||
|
obj->set("hls", hls);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
hls->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "hls_fragment") {
|
||||||
|
hls->set("hls_fragment", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_td_ratio") {
|
||||||
|
hls->set("hls_td_ratio", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_aof_ratio") {
|
||||||
|
hls->set("hls_aof_ratio", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_window") {
|
||||||
|
hls->set("hls_window", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_on_error") {
|
||||||
|
hls->set("hls_on_error", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_storage") {
|
||||||
|
hls->set("hls_storage", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_path") {
|
||||||
|
hls->set("hls_path", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_m3u8_file") {
|
||||||
|
hls->set("hls_m3u8_file", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_ts_file") {
|
||||||
|
hls->set("hls_ts_file", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_ts_floor") {
|
||||||
|
hls->set("hls_ts_floor", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "hls_entry_prefix") {
|
||||||
|
hls->set("hls_entry_prefix", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_mount") {
|
||||||
|
hls->set("hls_mount", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_acodec") {
|
||||||
|
hls->set("hls_acodec", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_vcodec") {
|
||||||
|
hls->set("hls_vcodec", sdir->dumps_arg0_to_str());
|
||||||
|
} else if (sdir->name == "hls_cleanup") {
|
||||||
|
hls->set("hls_cleanup", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "hls_dispose") {
|
||||||
|
hls->set("hls_dispose", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_nb_notify") {
|
||||||
|
hls->set("hls_nb_notify", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hls_wait_keyframe") {
|
||||||
|
hls->set("hls_wait_keyframe", sdir->dumps_arg0_to_boolean());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hds
|
||||||
|
if ((dir = vhost->get("hds")) != NULL) {
|
||||||
|
SrsAmf0Object* hds = SrsAmf0Any::object();
|
||||||
|
obj->set("hds", hds);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
hds->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "hds_fragment") {
|
||||||
|
hds->set("hds_fragment", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hds_window") {
|
||||||
|
hds->set("hds_window", sdir->dumps_arg0_to_number());
|
||||||
|
} else if (sdir->name == "hds_path") {
|
||||||
|
hds->set("hds_path", sdir->dumps_arg0_to_str());
|
||||||
}
|
}
|
||||||
if ((dir = vhost->get("token_traverse")) != NULL) {
|
|
||||||
obj->set("token_traverse", dir->dumps_arg0_to_boolean());
|
|
||||||
}
|
}
|
||||||
if ((dir = vhost->get("vhost")) != NULL) {
|
|
||||||
obj->set("vhost", dir->dumps_arg0_to_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dvr
|
// dvr
|
||||||
|
@ -1881,6 +2121,22 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exec
|
||||||
|
if ((dir = vhost->get("exec")) != NULL) {
|
||||||
|
SrsAmf0Object* ng_exec = SrsAmf0Any::object();
|
||||||
|
obj->set("exec", ng_exec);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
|
if (sdir->name == "enabled") {
|
||||||
|
ng_exec->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
|
} else if (sdir->name == "publish") {
|
||||||
|
ng_exec->set("publish", sdir->dumps_args());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ingest
|
// ingest
|
||||||
SrsAmf0StrictArray* ingests = NULL;
|
SrsAmf0StrictArray* ingests = NULL;
|
||||||
for (int i = 0; i < (int)vhost->directives.size(); i++) {
|
for (int i = 0; i < (int)vhost->directives.size(); i++) {
|
||||||
|
@ -1929,40 +2185,28 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http_static
|
// transcode
|
||||||
if ((dir = vhost->get("http_static")) != NULL) {
|
if ((dir = vhost->get("transcode")) != NULL) {
|
||||||
SrsAmf0Object* http_static = SrsAmf0Any::object();
|
SrsAmf0Object* transcode = SrsAmf0Any::object();
|
||||||
obj->set("http_static", http_static);
|
obj->set("transcode", transcode);
|
||||||
|
|
||||||
|
SrsAmf0StrictArray* engines = SrsAmf0Any::strict_array();
|
||||||
|
obj->set("engines", engines);
|
||||||
|
|
||||||
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||||
SrsConfDirective* sdir = dir->directives.at(i);
|
SrsConfDirective* sdir = dir->directives.at(i);
|
||||||
|
|
||||||
if (sdir->name == "enabled") {
|
if (sdir->name == "enabled") {
|
||||||
http_static->set("enabled", sdir->dumps_arg0_to_boolean());
|
transcode->set("enabled", sdir->dumps_arg0_to_boolean());
|
||||||
} else if (sdir->name == "mount") {
|
} else if (sdir->name == "ffmpeg") {
|
||||||
http_static->set("mount", sdir->dumps_arg0_to_str());
|
transcode->set("ffmpeg", sdir->dumps_arg0_to_str());
|
||||||
} else if (sdir->name == "dir") {
|
} else if (sdir->name == "engine") {
|
||||||
http_static->set("dir", sdir->dumps_arg0_to_str());
|
SrsAmf0Object* engine = SrsAmf0Any::object();
|
||||||
}
|
engines->append(engine);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// http_remux
|
if ((ret = dumps_engine(sdir, engine)) != ERROR_SUCCESS) {
|
||||||
if ((dir = vhost->get("http_remux")) != NULL) {
|
return ret;
|
||||||
SrsAmf0Object* http_remux = SrsAmf0Any::object();
|
}
|
||||||
obj->set("http_remux", http_remux);
|
|
||||||
|
|
||||||
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
|
||||||
SrsConfDirective* sdir = dir->directives.at(i);
|
|
||||||
|
|
||||||
if (sdir->name == "enabled") {
|
|
||||||
http_remux->set("enabled", sdir->dumps_arg0_to_boolean());
|
|
||||||
} else if (sdir->name == "fast_cache") {
|
|
||||||
http_remux->set("fast_cache", sdir->dumps_arg0_to_number());
|
|
||||||
} else if (sdir->name == "mount") {
|
|
||||||
http_remux->set("mount", sdir->dumps_arg0_to_str());
|
|
||||||
} else if (sdir->name == "hstrs") {
|
|
||||||
http_remux->set("hstrs", sdir->dumps_arg0_to_boolean());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1997,6 +2241,8 @@ int SrsConfig::dumps_engine(SrsConfDirective* dir, SrsAmf0Object* engine)
|
||||||
|
|
||||||
SrsConfDirective* conf = NULL;
|
SrsConfDirective* conf = NULL;
|
||||||
|
|
||||||
|
engine->set("name", dir->dumps_arg0_to_str());
|
||||||
|
|
||||||
if ((conf = dir->get("enabled")) != NULL) {
|
if ((conf = dir->get("enabled")) != NULL) {
|
||||||
engine->set("enabled", conf->dumps_arg0_to_boolean());
|
engine->set("enabled", conf->dumps_arg0_to_boolean());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue