mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
for #319, the vhost scope config is enabled, chunk_size, tcp_nodelay and min_latency.
This commit is contained in:
parent
9c4340f789
commit
4eb1874955
5 changed files with 311 additions and 296 deletions
|
@ -62,7 +62,6 @@ vhost __defaultVhost__ {
|
|||
atc on;
|
||||
atc_auto on;
|
||||
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
|
||||
gop_cache off;
|
||||
|
|
|
@ -229,6 +229,71 @@ stream_caster {
|
|||
# for which cannot identify the required vhost.
|
||||
vhost __defaultVhost__ {
|
||||
}
|
||||
|
||||
# the vhost scope configs.
|
||||
vhost scope.vhost.srs.com {
|
||||
# whether the vhost is enabled.
|
||||
# if off, all request access denied.
|
||||
# default: on
|
||||
enabled off;
|
||||
|
||||
# whether enable min delay mode for vhost.
|
||||
# for min latence mode:
|
||||
# 1. disable the publish.mr for vhost.
|
||||
# 2. use timeout for cond wait for consumer queue.
|
||||
# @see https://github.com/simple-rtmp-server/srs/issues/257
|
||||
# default: off
|
||||
min_latency off;
|
||||
|
||||
# whether enable the TCP_NODELAY
|
||||
# if on, set the nodelay of fd by setsockopt
|
||||
# default: off
|
||||
tcp_nodelay off;
|
||||
|
||||
# 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;
|
||||
}
|
||||
|
||||
# set the chunk size of vhost.
|
||||
vhost chunksize.srs.com {
|
||||
# @see scope.vhost.srs.com
|
||||
chunk_size 128;
|
||||
}
|
||||
|
||||
# the vhost disabled.
|
||||
vhost removed.srs.com {
|
||||
# @see scope.vhost.srs.com
|
||||
enabled off;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# the vhost for antisuck.
|
||||
vhost refer.anti_suck.com {
|
||||
|
@ -280,30 +345,206 @@ vhost bandcheck.srs.com {
|
|||
}
|
||||
}
|
||||
|
||||
# the publish specified configs
|
||||
vhost publish.srs.com {
|
||||
# the config for FMLE/Flash publisher, which push RTMP to SRS.
|
||||
publish {
|
||||
# about MR, read https://github.com/simple-rtmp-server/srs/issues/241
|
||||
# when enabled the mr, SRS will read as large as possible.
|
||||
# default: off
|
||||
mr off;
|
||||
# the latency in ms for MR(merged-read),
|
||||
# the performance+ when latency+, and memory+,
|
||||
# memory(buffer) = latency * kbps / 8
|
||||
# for example, latency=500ms, kbps=3000kbps, each publish connection will consume
|
||||
# memory = 500 * 3000 / 8 = 187500B = 183KB
|
||||
# when there are 2500 publisher, the total memory of SRS atleast:
|
||||
# 183KB * 2500 = 446MB
|
||||
# the value recomment is [300, 2000]
|
||||
# default: 350
|
||||
mr_latency 350;
|
||||
|
||||
# the 1st packet timeout in ms for encoder.
|
||||
# default: 20000
|
||||
firstpkt_timeout 20000;
|
||||
# the normal packet timeout in ms for encoder.
|
||||
# default: 5000
|
||||
normal_timeout 7000;
|
||||
}
|
||||
}
|
||||
|
||||
# the MR(merged-read) setting for publisher.
|
||||
# the MW(merged-write) settings for player.
|
||||
vhost mrw.srs.com {
|
||||
# @see scope.vhost.srs.com
|
||||
min_latency off;
|
||||
|
||||
# set the MW(merged-write) latency in ms.
|
||||
# SRS always set mw on, so we just set the latency value.
|
||||
# the latency of stream >= mw_latency + mr_latency
|
||||
# the value recomment is [300, 1800]
|
||||
# default: 350
|
||||
mw_latency 350;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr on;
|
||||
mr_latenct 350;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost for min delay, donot cache any stream.
|
||||
vhost min.delay.com {
|
||||
# @see vhost mrw.srs.com for detail.
|
||||
min_latency on;
|
||||
# @see scope.vhost.srs.com
|
||||
mw_latency 100;
|
||||
# whether cache the last gop.
|
||||
# if on, cache the last gop and dispatch to client,
|
||||
# to enabled fast startup for client, client play immediately.
|
||||
# if off, send the latest media data to client,
|
||||
# client need to wait for the next Iframe to decode and show the video.
|
||||
# set to off if requires min delay;
|
||||
# set to on if requires client fast startup.
|
||||
# default: on
|
||||
gop_cache off;
|
||||
# the max live queue length in seconds.
|
||||
# if the messages in the queue exceed the max length,
|
||||
# drop the old whole gop.
|
||||
# default: 30
|
||||
queue_length 10;
|
||||
# @see scope.vhost.srs.com
|
||||
tcp_nodelay on;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr off;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost to control the stream delivery feature
|
||||
vhost stream.control.com {
|
||||
# @see vhost mrw.srs.com for detail.
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
# @see vhost min.delay.com
|
||||
queue_length 10;
|
||||
tcp_nodelay on;
|
||||
# the minimal packets send interval in ms,
|
||||
# used to control the ndiff of stream by srs_rtmp_dump,
|
||||
# for example, some device can only accept some stream which
|
||||
# delivery packets in constant interval(not cbr).
|
||||
# @remark 0 to disable the minimal interval.
|
||||
# @remark >0 to make the srs to send message one by one.
|
||||
# @remark user can get the right packets interval in ms by srs_rtmp_dump.
|
||||
# default: 0
|
||||
send_min_interval 10.0;
|
||||
# whether reduce the sequence header,
|
||||
# for some client which cannot got duplicated sequence header,
|
||||
# while the sequence header is not changed yet.
|
||||
# default: off
|
||||
reduce_sequence_header on;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr off;
|
||||
firstpkt_timeout 20000;
|
||||
normal_timeout 7000;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost which forward publish streams.
|
||||
vhost same.vhost.forward.srs.com {
|
||||
# forward all publish stream to the specified server.
|
||||
# this used to split/forward the current stream for cluster active-standby,
|
||||
# active-active for cdn to build high available fault tolerance system.
|
||||
# format: {ip}:{port} {ip_N}:{port_N}
|
||||
forward 127.0.0.1:1936 127.0.0.1:1937;
|
||||
}
|
||||
|
||||
# the vhost for exec, fork process when publish stream.
|
||||
vhost exec.srs.com {
|
||||
# the exec used to fork process when got some event.
|
||||
exec {
|
||||
# whether enable the exec.
|
||||
# default: off.
|
||||
enabled off;
|
||||
# when publish stream, exec the process with variables:
|
||||
# [vhost] the input stream vhost.
|
||||
# [port] the intput stream port.
|
||||
# [app] the input stream app.
|
||||
# [stream] the input stream name.
|
||||
# [engine] the tanscode engine name.
|
||||
# other variables for exec only:
|
||||
# [url] the rtmp url which trigger the publish.
|
||||
# [tcUrl] the client request tcUrl.
|
||||
# [swfUrl] the client request swfUrl.
|
||||
# [pageUrl] the client request pageUrl.
|
||||
# @remark empty to ignore this exec.
|
||||
publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
|
||||
}
|
||||
}
|
||||
|
||||
# the play specified configs
|
||||
vhost play.srs.com {
|
||||
# for play client, both RTMP and other stream clients,
|
||||
# for instance, the HTTP FLV stream clients.
|
||||
play {
|
||||
# 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 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 off;
|
||||
# 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: off
|
||||
atc_auto off;
|
||||
}
|
||||
}
|
||||
|
||||
# vhost for time jitter
|
||||
vhost jitter.srs.com {
|
||||
# @see play.srs.com
|
||||
time_jitter full;
|
||||
# @see play.srs.com
|
||||
mix_correct off;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vhost for atc.
|
||||
vhost atc.srs.com {
|
||||
# @see play.srs.com
|
||||
atc on;
|
||||
# @see play.srs.com
|
||||
atc_auto on;
|
||||
}
|
||||
|
||||
# the security to allow or deny clients.
|
||||
vhost security.srs.com {
|
||||
|
@ -932,229 +1173,6 @@ vhost debug.srs.com {
|
|||
debug_srs_upnode on;
|
||||
}
|
||||
|
||||
# the publish specified configs
|
||||
vhost publish.srs.com {
|
||||
# the config for FMLE/Flash publisher, which push RTMP to SRS.
|
||||
publish {
|
||||
# about MR, read https://github.com/simple-rtmp-server/srs/issues/241
|
||||
# when enabled the mr, SRS will read as large as possible.
|
||||
# default: off
|
||||
mr off;
|
||||
# the latency in ms for MR(merged-read),
|
||||
# the performance+ when latency+, and memory+,
|
||||
# memory(buffer) = latency * kbps / 8
|
||||
# for example, latency=500ms, kbps=3000kbps, each publish connection will consume
|
||||
# memory = 500 * 3000 / 8 = 187500B = 183KB
|
||||
# when there are 2500 publisher, the total memory of SRS atleast:
|
||||
# 183KB * 2500 = 446MB
|
||||
# the value recomment is [300, 2000]
|
||||
# default: 350
|
||||
mr_latency 350;
|
||||
|
||||
# the 1st packet timeout in ms for encoder.
|
||||
# default: 20000
|
||||
firstpkt_timeout 20000;
|
||||
# the normal packet timeout in ms for encoder.
|
||||
# default: 5000
|
||||
normal_timeout 7000;
|
||||
}
|
||||
}
|
||||
|
||||
# the MR(merged-read) setting for publisher.
|
||||
# the MW(merged-write) settings for player.
|
||||
vhost mrw.srs.com {
|
||||
# whether enable min delay mode for vhost.
|
||||
# for min latence mode:
|
||||
# 1. disable the publish.mr for vhost.
|
||||
# 2. use timeout for cond wait for consumer queue.
|
||||
# @see https://github.com/simple-rtmp-server/srs/issues/257
|
||||
# default: off
|
||||
min_latency off;
|
||||
# set the MW(merged-write) latency in ms.
|
||||
# SRS always set mw on, so we just set the latency value.
|
||||
# the latency of stream >= mw_latency + mr_latency
|
||||
# the value recomment is [300, 1800]
|
||||
# default: 350
|
||||
mw_latency 350;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr on;
|
||||
mr_latenct 350;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost for min delay, donot cache any stream.
|
||||
vhost min.delay.com {
|
||||
# @see vhost mrw.srs.com for detail.
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
# whether cache the last gop.
|
||||
# if on, cache the last gop and dispatch to client,
|
||||
# to enabled fast startup for client, client play immediately.
|
||||
# if off, send the latest media data to client,
|
||||
# client need to wait for the next Iframe to decode and show the video.
|
||||
# set to off if requires min delay;
|
||||
# set to on if requires client fast startup.
|
||||
# default: on
|
||||
gop_cache off;
|
||||
# the max live queue length in seconds.
|
||||
# if the messages in the queue exceed the max length,
|
||||
# drop the old whole gop.
|
||||
# default: 30
|
||||
queue_length 10;
|
||||
# whether enable the TCP_NODELAY
|
||||
# if on, set the nodelay of fd by setsockopt
|
||||
# default: off
|
||||
tcp_nodelay on;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr off;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost to control the stream delivery feature
|
||||
vhost stream.control.com {
|
||||
# @see vhost mrw.srs.com for detail.
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
# @see vhost min.delay.com
|
||||
queue_length 10;
|
||||
tcp_nodelay on;
|
||||
# the minimal packets send interval in ms,
|
||||
# used to control the ndiff of stream by srs_rtmp_dump,
|
||||
# for example, some device can only accept some stream which
|
||||
# delivery packets in constant interval(not cbr).
|
||||
# @remark 0 to disable the minimal interval.
|
||||
# @remark >0 to make the srs to send message one by one.
|
||||
# @remark user can get the right packets interval in ms by srs_rtmp_dump.
|
||||
# default: 0
|
||||
send_min_interval 10.0;
|
||||
# whether reduce the sequence header,
|
||||
# for some client which cannot got duplicated sequence header,
|
||||
# while the sequence header is not changed yet.
|
||||
# default: off
|
||||
reduce_sequence_header on;
|
||||
|
||||
# @see publish.srs.com
|
||||
publish {
|
||||
mr off;
|
||||
firstpkt_timeout 20000;
|
||||
normal_timeout 7000;
|
||||
}
|
||||
}
|
||||
|
||||
# the vhost which forward publish streams.
|
||||
vhost same.vhost.forward.srs.com {
|
||||
# forward all publish stream to the specified server.
|
||||
# this used to split/forward the current stream for cluster active-standby,
|
||||
# active-active for cdn to build high available fault tolerance system.
|
||||
# format: {ip}:{port} {ip_N}:{port_N}
|
||||
forward 127.0.0.1:1936 127.0.0.1:1937;
|
||||
}
|
||||
|
||||
# the vhost for exec, fork process when publish stream.
|
||||
vhost exec.srs.com {
|
||||
# the exec used to fork process when got some event.
|
||||
exec {
|
||||
# whether enable the exec.
|
||||
# default: off.
|
||||
enabled off;
|
||||
# when publish stream, exec the process with variables:
|
||||
# [vhost] the input stream vhost.
|
||||
# [port] the intput stream port.
|
||||
# [app] the input stream app.
|
||||
# [stream] the input stream name.
|
||||
# [engine] the tanscode engine name.
|
||||
# other variables for exec only:
|
||||
# [url] the rtmp url which trigger the publish.
|
||||
# [tcUrl] the client request tcUrl.
|
||||
# [swfUrl] the client request swfUrl.
|
||||
# [pageUrl] the client request pageUrl.
|
||||
# @remark empty to ignore this exec.
|
||||
publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
|
||||
}
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
|
||||
# the play specified configs
|
||||
vhost play.srs.com {
|
||||
# for play client, both RTMP and other stream clients,
|
||||
# for instance, the HTTP FLV stream clients.
|
||||
play {
|
||||
# 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 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 off;
|
||||
# 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: off
|
||||
atc_auto off;
|
||||
}
|
||||
}
|
||||
|
||||
# vhost for time jitter
|
||||
vhost jitter.srs.com {
|
||||
# @see play.srs.com
|
||||
time_jitter full;
|
||||
# @see play.srs.com
|
||||
mix_correct off;
|
||||
}
|
||||
|
||||
# vhost for atc.
|
||||
vhost atc.srs.com {
|
||||
# @see play.srs.com
|
||||
atc on;
|
||||
# @see play.srs.com
|
||||
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
|
||||
vhost example.transcode.srs.com {
|
||||
# the streaming transcode configs.
|
||||
|
|
|
@ -47,9 +47,9 @@ vhost __defaultVhost__ {
|
|||
}
|
||||
vhost vhost.srs.com {
|
||||
enabled off;
|
||||
|
||||
chunk_size 128;
|
||||
tcp_nodelay on;
|
||||
min_latency on;
|
||||
|
||||
# TODO
|
||||
cluster {
|
||||
|
@ -74,10 +74,9 @@ vhost vhost.srs.com {
|
|||
atc on;
|
||||
atc_auto on;
|
||||
|
||||
# TODO
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
|
||||
|
||||
# TODO
|
||||
gop_cache off;
|
||||
queue_length 10;
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
listen 1935;
|
||||
max_connections 1000;
|
||||
vhost __defaultVhost__ {
|
||||
tcp_nodelay on;
|
||||
tcp_nodelay on
|
||||
min_latency on;
|
||||
|
||||
play {
|
||||
gop_cache off;
|
||||
queue_length 10;
|
||||
min_latency on;
|
||||
mw_latency 100;
|
||||
}
|
||||
|
||||
|
|
|
@ -695,6 +695,43 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
// ENABLED => ENABLED (modified)
|
||||
if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) {
|
||||
srs_trace("vhost %s maybe modified, reload its detail.", vhost.c_str());
|
||||
|
||||
// chunk_size, only one per vhost.
|
||||
if (!srs_directive_equals(new_vhost->get("chunk_size"), old_vhost->get("chunk_size"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_chunk_size(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes chunk_size failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload chunk_size success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// tcp_nodelay, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("tcp_nodelay"), old_vhost->get("tcp_nodelay"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_tcp_nodelay(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes tcp_nodelay failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload tcp_nodelay success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// min_latency, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("min_latency"), old_vhost->get("min_latency"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_realtime(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes min_latency failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload min_latency success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// gop_cache, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -804,18 +841,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
srs_trace("vhost %s reload publish success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// chunk_size, only one per vhost.
|
||||
if (!srs_directive_equals(new_vhost->get("chunk_size"), old_vhost->get("chunk_size"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_chunk_size(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes chunk_size failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload chunk_size success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// mw, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("mw_latency"), old_vhost->get("mw_latency"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -840,30 +865,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
|||
srs_trace("vhost %s reload smi success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// tcp_nodelay, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("tcp_nodelay"), old_vhost->get("tcp_nodelay"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_tcp_nodelay(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes tcp_nodelay failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload tcp_nodelay success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// min_latency, only one per vhost
|
||||
if (!srs_directive_equals(new_vhost->get("min_latency"), old_vhost->get("min_latency"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
ISrsReloadHandler* subscribe = *it;
|
||||
if ((ret = subscribe->on_reload_vhost_realtime(vhost)) != ERROR_SUCCESS) {
|
||||
srs_error("vhost %s notify subscribes min_latency failed. ret=%d", vhost.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
srs_trace("vhost %s reload min_latency success.", vhost.c_str());
|
||||
}
|
||||
|
||||
// http_static, only one per vhost.
|
||||
if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) {
|
||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||
|
@ -1696,10 +1697,19 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
|||
|
||||
obj->set("name", vhost->dumps_arg0_to_str());
|
||||
|
||||
// enabled
|
||||
// vhost scope configs.
|
||||
if ((dir = vhost->get("enabled")) != NULL) {
|
||||
obj->set("enabled", dir->dumps_arg0_to_boolean());
|
||||
}
|
||||
if ((dir = vhost->get("chunk_size")) != NULL) {
|
||||
obj->set("chunk_size", dir->dumps_arg0_to_number());
|
||||
}
|
||||
if ((dir = vhost->get("min_latency")) != NULL) {
|
||||
obj->set("min_latency", dir->dumps_arg0_to_boolean());
|
||||
}
|
||||
if ((dir = vhost->get("tcp_nodelay")) != NULL) {
|
||||
obj->set("tcp_nodelay", dir->dumps_arg0_to_boolean());
|
||||
}
|
||||
|
||||
// edge.
|
||||
if ((dir = vhost->get("mode")) != NULL) {
|
||||
|
@ -1725,15 +1735,7 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
|||
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());
|
||||
}
|
||||
|
||||
// mrw
|
||||
if ((dir = vhost->get("min_latency")) != NULL) {
|
||||
obj->set("min_latency", dir->dumps_arg0_to_boolean());
|
||||
}
|
||||
if ((dir = vhost->get("mw_latency")) != NULL) {
|
||||
obj->set("mw_latency", dir->dumps_arg0_to_number());
|
||||
}
|
||||
|
@ -1745,9 +1747,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
|||
if ((dir = vhost->get("queue_length")) != NULL) {
|
||||
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) {
|
||||
|
@ -2650,13 +2649,13 @@ int SrsConfig::check_config()
|
|||
for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) {
|
||||
SrsConfDirective* conf = vhost->at(i);
|
||||
string n = conf->name;
|
||||
if (n != "enabled" && n != "chunk_size"
|
||||
if (n != "enabled" && n != "chunk_size" && n != "min_latency" && n != "tcp_nodelay"
|
||||
&& n != "mode" && n != "origin" && n != "token_traverse" && n != "vhost"
|
||||
&& n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks"
|
||||
&& n != "gop_cache" && n != "queue_length"
|
||||
&& n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck"
|
||||
&& n != "debug_srs_upnode" && n != "play" && n != "publish" && n != "mw_latency" && n != "min_latency"
|
||||
&& n != "tcp_nodelay" && n != "send_min_interval" && n != "reduce_sequence_header"
|
||||
&& n != "debug_srs_upnode" && n != "play" && n != "publish" && n != "mw_latency"
|
||||
&& n != "send_min_interval" && n != "reduce_sequence_header"
|
||||
&& n != "security" && n != "http_remux"
|
||||
&& n != "http_static" && n != "hds" && n != "exec"
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue