Config: Support overwrote by environment variables. (#3200)

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
pull/3212/head
mapengfei53 2 years ago committed by GitHub
parent f1be2ebd3b
commit dd563d45ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -342,9 +342,9 @@ srt_server {
vhost srt.vhost.srs.com { vhost srt.vhost.srs.com {
srt { srt {
# Overwrite by env SRS_SRT_ENABLED for all vhosts. # Overwrite by env SRS_VHOST_SRT_ENABLED for all vhosts.
enabled on; enabled on;
# Overwrite by env SRS_SRT_TO_RTMP for all vhosts. # Overwrite by env SRS_VHOST_SRT_TO_RTMP for all vhosts.
srt_to_rtmp on; srt_to_rtmp on;
} }
} }
@ -1643,6 +1643,7 @@ vhost hls.srs.com {
hls { hls {
# whether the hls is enabled. # whether the hls is enabled.
# if off, do not write hls(ts and m3u8) when publish. # if off, do not write hls(ts and m3u8) when publish.
# Overwrite by env SRS_VHOST_HLS_ENABLED for all vhosts.
# default: off # default: off
enabled on; enabled on;
@ -1655,6 +1656,7 @@ vhost hls.srs.com {
# as a "fake" connection, do HTTP callback when start playing the HLS streaming. You're able to do querying and # as a "fake" connection, do HTTP callback when start playing the HLS streaming. You're able to do querying and
# authentication. # authentication.
# Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges. # Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
# Overwrite by env SRS_VHOST_HLS_HLS_CTX for all vhosts.
# Default: on # Default: on
hls_ctx on; hls_ctx on;
# For HLS pseudo streaming, whether enable the session for each TS segment. # For HLS pseudo streaming, whether enable the session for each TS segment.
@ -1662,6 +1664,7 @@ vhost hls.srs.com {
# note that it also consumes resource, because each ts file should be served by SRS, all NGINX cache will be # note that it also consumes resource, because each ts file should be served by SRS, all NGINX cache will be
# missed because we add session id to each ts file. # missed because we add session id to each ts file.
# Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges. # Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
# Overwrite by env SRS_VHOST_HLS_HLS_TS_CTX for all vhosts.
# Default: on # Default: on
hls_ts_ctx on; hls_ts_ctx on;
@ -1672,15 +1675,18 @@ vhost hls.srs.com {
# EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init # EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
# EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts # EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
# @see https://github.com/ossrs/srs/issues/304#issuecomment-74000081 # @see https://github.com/ossrs/srs/issues/304#issuecomment-74000081
# Overwrite by env SRS_VHOST_HLS_HLS_TD_RATIO for all vhosts.
# default: 1.5 # default: 1.5
hls_td_ratio 1.5; hls_td_ratio 1.5;
# the audio overflow ratio. # the audio overflow ratio.
# for pure audio, the duration to reap the segment. # for pure audio, the duration to reap the segment.
# for example, the hls_fragment is 10s, hls_aof_ratio is 2.0, # for example, the hls_fragment is 10s, hls_aof_ratio is 2.0,
# the segment will reap to 20s for pure audio. # the segment will reap to 20s for pure audio.
# Overwrite by env SRS_VHOST_HLS_HLS_AOF_RATIO for all vhosts.
# default: 2.0 # default: 2.0
hls_aof_ratio 2.0; hls_aof_ratio 2.0;
# the hls window in seconds, the number of ts in m3u8. # the hls window in seconds, the number of ts in m3u8.
# Overwrite by env SRS_VHOST_HLS_HLS_WINDOW for all vhosts.
# default: 60 # default: 60
hls_window 60; hls_window 60;
# the error strategy. can be: # the error strategy. can be:
@ -1688,6 +1694,7 @@ vhost hls.srs.com {
# disconnect, require encoder republish. # disconnect, require encoder republish.
# continue, ignore failed try to continue output hls. # continue, ignore failed try to continue output hls.
# @see https://github.com/ossrs/srs/issues/264 # @see https://github.com/ossrs/srs/issues/264
# Overwrite by env SRS_VHOST_HLS_HLS_ON_ERROR for all vhosts.
# default: continue # default: continue
hls_on_error continue; hls_on_error continue;
# the hls output path. # the hls output path.
@ -1696,6 +1703,7 @@ vhost hls.srs.com {
# the ts file is configured by hls_path/hls_ts_file, the default is: # the ts file is configured by hls_path/hls_ts_file, the default is:
# ./objs/nginx/html/[app]/[stream]-[seq].ts # ./objs/nginx/html/[app]/[stream]-[seq].ts
# @remark the hls_path is compatible with srs v1 config. # @remark the hls_path is compatible with srs v1 config.
# Overwrite by env SRS_VHOST_HLS_HLS_PATH for all vhosts.
# default: ./objs/nginx/html # default: ./objs/nginx/html
hls_path ./objs/nginx/html; hls_path ./objs/nginx/html;
# the hls m3u8 file name. # the hls m3u8 file name.
@ -1703,6 +1711,7 @@ vhost hls.srs.com {
# [vhost], the vhost of stream. # [vhost], the vhost of stream.
# [app], the app of stream. # [app], the app of stream.
# [stream], the stream name of stream. # [stream], the stream name of stream.
# Overwrite by env SRS_VHOST_HLS_HLS_M3U8_FILE for all vhosts.
# default: [app]/[stream].m3u8 # default: [app]/[stream].m3u8
hls_m3u8_file [app]/[stream].m3u8; hls_m3u8_file [app]/[stream].m3u8;
# the hls ts file name. # the hls ts file name.
@ -1722,12 +1731,14 @@ vhost hls.srs.com {
# [duration], replace this const to current ts duration. # [duration], replace this const to current ts duration.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls#hls-config # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls#hls-config
# Overwrite by env SRS_VHOST_HLS_HLS_TS_FILE for all vhosts.
# default: [app]/[stream]-[seq].ts # default: [app]/[stream]-[seq].ts
hls_ts_file [app]/[stream]-[seq].ts; hls_ts_file [app]/[stream]-[seq].ts;
# whether use floor for the hls_ts_file path generation. # whether use floor for the hls_ts_file path generation.
# if on, use floor(timestamp/hls_fragment) as the variable [timestamp], # if on, use floor(timestamp/hls_fragment) as the variable [timestamp],
# and use enhanced algorithm to calc deviation for segment. # and use enhanced algorithm to calc deviation for segment.
# @remark when floor on, recommend the hls_segment>=2*gop. # @remark when floor on, recommend the hls_segment>=2*gop.
# Overwrite by env SRS_VHOST_HLS_HLS_TS_FLOOR for all vhosts.
# default: off # default: off
hls_ts_floor off; hls_ts_floor off;
# the hls entry prefix, which is base url of ts url. # the hls entry prefix, which is base url of ts url.
@ -1737,6 +1748,7 @@ vhost hls.srs.com {
# http://your-server/live/livestream-0.ts # http://your-server/live/livestream-0.ts
# http://your-server/live/livestream-1.ts # http://your-server/live/livestream-1.ts
# ... # ...
# Overwrite by env SRS_VHOST_HLS_HLS_ENTRY_PREFIX for all vhosts.
# optional, default to empty string. # optional, default to empty string.
hls_entry_prefix http://your-server; hls_entry_prefix http://your-server;
# the default audio codec of hls. # the default audio codec of hls.
@ -1744,6 +1756,7 @@ vhost hls.srs.com {
# so user can set the default codec for mp3. # so user can set the default codec for mp3.
# the available audio codec: # the available audio codec:
# aac, mp3, an # aac, mp3, an
# Overwrite by env SRS_VHOST_HLS_HLS_ACODEC for all vhosts.
# default: aac # default: aac
hls_acodec aac; hls_acodec aac;
# the default video codec of hls. # the default video codec of hls.
@ -1751,32 +1764,39 @@ vhost hls.srs.com {
# so user can set the default codec for pure audio(without video) to vn. # so user can set the default codec for pure audio(without video) to vn.
# the available video codec: # the available video codec:
# h264, vn # h264, vn
# Overwrite by env SRS_VHOST_HLS_HLS_VCODEC for all vhosts.
# default: h264 # default: h264
hls_vcodec h264; hls_vcodec h264;
# whether cleanup the old expired ts files. # whether cleanup the old expired ts files.
# Overwrite by env SRS_VHOST_HLS_HLS_CLEANUP for all vhosts.
# default: on # default: on
hls_cleanup on; hls_cleanup on;
# If there is no incoming packets, dispose HLS in this timeout in seconds, # If there is no incoming packets, dispose HLS in this timeout in seconds,
# which removes all HLS files including m3u8 and ts files. # which removes all HLS files including m3u8 and ts files.
# @remark 0 to disable dispose for publisher. # @remark 0 to disable dispose for publisher.
# @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose hls. # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose hls.
# Overwrite by env SRS_VHOST_HLS_HLS_DISPOSE for all vhosts.
# default: 0 # default: 0
hls_dispose 0; hls_dispose 0;
# the max size to notify hls, # the max size to notify hls,
# to read max bytes from ts of specified cdn network, # to read max bytes from ts of specified cdn network,
# @remark only used when on_hls_notify is config. # @remark only used when on_hls_notify is config.
# Overwrite by env SRS_VHOST_HLS_HLS_NB_NOTIFY for all vhosts.
# default: 64 # default: 64
hls_nb_notify 64; hls_nb_notify 64;
# whether wait keyframe to reap segment, # whether wait keyframe to reap segment,
# if off, reap segment when duration exceed the fragment, # if off, reap segment when duration exceed the fragment,
# if on, reap segment when duration exceed and got keyframe. # if on, reap segment when duration exceed and got keyframe.
# Overwrite by env SRS_VHOST_HLS_HLS_WAIT_KEYFRAME for all vhosts.
# default: on # default: on
hls_wait_keyframe on; hls_wait_keyframe on;
# whether using AES encryption. # whether using AES encryption.
# Overwrite by env SRS_VHOST_HLS_HLS_KEYS for all vhosts.
# default: off # default: off
hls_keys on; hls_keys on;
# the number of clear ts which one key can encrypt. # the number of clear ts which one key can encrypt.
# Overwrite by env SRS_VHOST_HLS_HLS_FRAGMENTS_PER_KEY for all vhosts.
# default: 5 # default: 5
hls_fragments_per_key 5; hls_fragments_per_key 5;
# the hls key file name. # the hls key file name.
@ -1785,13 +1805,16 @@ vhost hls.srs.com {
# [app], the app of stream. # [app], the app of stream.
# [stream], the stream name of stream. # [stream], the stream name of stream.
# [seq], the sequence number of key corresponding to the ts. # [seq], the sequence number of key corresponding to the ts.
# Overwrite by env SRS_VHOST_HLS_HLS_KEY_FILE for all vhosts.
hls_key_file [app]/[stream]-[seq].key; hls_key_file [app]/[stream]-[seq].key;
# the key output path. # the key output path.
# the key file is configed by hls_path/hls_key_file, the default is: # the key file is configed by hls_path/hls_key_file, the default is:
# ./objs/nginx/html/[app]/[stream]-[seq].key # ./objs/nginx/html/[app]/[stream]-[seq].key
# Overwrite by env SRS_VHOST_HLS_HLS_KEY_FILE_PATH for all vhosts.
hls_key_file_path ./objs/nginx/html; hls_key_file_path ./objs/nginx/html;
# the key root URL, use this can support https. # the key root URL, use this can support https.
# @remark It's optional. # @remark It's optional.
# Overwrite by env SRS_VHOST_HLS_HLS_KEY_URL for all vhosts.
hls_key_url https://localhost:8080; hls_key_url https://localhost:8080;
# Special control controls. # Special control controls.
@ -1800,6 +1823,7 @@ vhost hls.srs.com {
# If on, guess the specific DTS by AAC samples, please read https://github.com/ossrs/srs/issues/547#issuecomment-294350544 # If on, guess the specific DTS by AAC samples, please read https://github.com/ossrs/srs/issues/547#issuecomment-294350544
# If off, directly turn the FLV timestamp to DTS, which might cause corrupt audio stream. # If off, directly turn the FLV timestamp to DTS, which might cause corrupt audio stream.
# @remark Recommend to set to off, unless your audio stream sample-rate and timestamp is not correct. # @remark Recommend to set to off, unless your audio stream sample-rate and timestamp is not correct.
# Overwrite by env SRS_VHOST_HLS_HLS_DTS_DIRECTLY for all vhosts.
# Default: on # Default: on
hls_dts_directly on; hls_dts_directly on;
@ -1833,15 +1857,19 @@ vhost no-hls.srs.com {
vhost hds.srs.com { vhost hds.srs.com {
hds { hds {
# whether hds enabled # whether hds enabled
# Overwrite by env SRS_VHOST_HDS_ENABLED for all vhosts.
# default: off # default: off
enabled on; enabled on;
# the hds fragment in seconds. # the hds fragment in seconds.
# Overwrite by env SRS_VHOST_HDS_FRAGMENT for all vhosts.
# default: 10 # default: 10
hds_fragment 10; hds_fragment 10;
# the hds window in seconds, erase the segment when exceed the window. # the hds window in seconds, erase the segment when exceed the window.
# Overwrite by env SRS_VHOST_HDS_HDS_WINDOW for all vhosts.
# default: 60 # default: 60
hds_window 60; hds_window 60;
# the path to store the hds files. # the path to store the hds files.
# Overwrite by env SRS_VHOST_HDS_HDS_PATH for all vhosts.
# default: ./objs/nginx/html # default: ./objs/nginx/html
hds_path ./objs/nginx/html; hds_path ./objs/nginx/html;
} }
@ -1854,6 +1882,7 @@ vhost dvr.srs.com {
# reap flv/mp4 according by specified dvr_plan. # reap flv/mp4 according by specified dvr_plan.
dvr { dvr {
# whether enabled dvr features # whether enabled dvr features
# Overwrite by env SRS_VHOST_DVR_ENABLED for all vhosts.
# default: off # default: off
enabled on; enabled on;
# the filter for dvr to apply to. # the filter for dvr to apply to.
@ -1868,6 +1897,7 @@ vhost dvr.srs.com {
# session reap flv/mp4 when session end(unpublish). # session reap flv/mp4 when session end(unpublish).
# segment reap flv/mp4 when flv duration exceed the specified dvr_duration. # segment reap flv/mp4 when flv duration exceed the specified dvr_duration.
# @remark The plan append is removed in SRS3+, for it's no use. # @remark The plan append is removed in SRS3+, for it's no use.
# Overwrite by env SRS_VHOST_DVR_DVR_PLAN for all vhosts.
# default: session # default: session
dvr_plan session; dvr_plan session;
# the dvr output path, *.flv or *.mp4. # the dvr output path, *.flv or *.mp4.
@ -1908,11 +1938,13 @@ vhost dvr.srs.com {
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path
# @see https://ossrs.io/lts/en-us/docs/v4/doc/dvr#custom-path # @see https://ossrs.io/lts/en-us/docs/v4/doc/dvr#custom-path
# segment,session apply it. # segment,session apply it.
# Overwrite by env SRS_VHOST_DVR_DVR_PATH for all vhosts.
# default: ./objs/nginx/html/[app]/[stream].[timestamp].flv # default: ./objs/nginx/html/[app]/[stream].[timestamp].flv
dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv; dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
# the duration for dvr file, reap if exceed, in seconds. # the duration for dvr file, reap if exceed, in seconds.
# segment apply it. # segment apply it.
# session,append ignore. # session,append ignore.
# Overwrite by env SRS_VHOST_DVR_DVR_DURATION for all vhosts.
# default: 30 # default: 30
dvr_duration 30; dvr_duration 30;
# whether wait keyframe to reap segment, # whether wait keyframe to reap segment,
@ -1920,6 +1952,7 @@ vhost dvr.srs.com {
# if on, reap segment when duration exceed and got keyframe. # if on, reap segment when duration exceed and got keyframe.
# segment apply it. # segment apply it.
# session,append ignore. # session,append ignore.
# Overwrite by env SRS_VHOST_DVR_DVR_WAIT_KEYFRAME for all vhosts.
# default: on # default: on
dvr_wait_keyframe on; dvr_wait_keyframe on;
# about the stream monotonically increasing: # about the stream monotonically increasing:
@ -1933,6 +1966,7 @@ vhost dvr.srs.com {
# 2. zero, only ensure stream start at zero, ignore timestamp jitter. # 2. zero, only ensure stream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc. # 3. off, disable the time jitter algorithm, like atc.
# apply for all dvr plan. # apply for all dvr plan.
# Overwrite by env SRS_VHOST_DVR_TIME_JITTER for all vhosts.
# default: full # default: full
time_jitter full; time_jitter full;

@ -6534,6 +6534,8 @@ SrsConfDirective* SrsConfig::get_hls(string vhost)
bool SrsConfig::get_hls_enabled(string vhost) bool SrsConfig::get_hls_enabled(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.hls.enabled");
static bool DEFAULT = false; static bool DEFAULT = false;
SrsConfDirective* conf = get_vhost(vhost); SrsConfDirective* conf = get_vhost(vhost);
@ -6564,6 +6566,8 @@ bool SrsConfig::get_hls_enabled(SrsConfDirective* vhost)
string SrsConfig::get_hls_entry_prefix(string vhost) string SrsConfig::get_hls_entry_prefix(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_entry_prefix");
static string DEFAULT = ""; static string DEFAULT = "";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6581,6 +6585,8 @@ string SrsConfig::get_hls_entry_prefix(string vhost)
string SrsConfig::get_hls_path(string vhost) string SrsConfig::get_hls_path(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_path");
static string DEFAULT = "./objs/nginx/html"; static string DEFAULT = "./objs/nginx/html";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6598,6 +6604,8 @@ string SrsConfig::get_hls_path(string vhost)
string SrsConfig::get_hls_m3u8_file(string vhost) string SrsConfig::get_hls_m3u8_file(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_m3u8_file");
static string DEFAULT = "[app]/[stream].m3u8"; static string DEFAULT = "[app]/[stream].m3u8";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6615,6 +6623,8 @@ string SrsConfig::get_hls_m3u8_file(string vhost)
string SrsConfig::get_hls_ts_file(string vhost) string SrsConfig::get_hls_ts_file(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_ts_file");
static string DEFAULT = "[app]/[stream]-[seq].ts"; static string DEFAULT = "[app]/[stream]-[seq].ts";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6649,6 +6659,8 @@ bool SrsConfig::get_hls_ts_floor(string vhost)
srs_utime_t SrsConfig::get_hls_fragment(string vhost) srs_utime_t SrsConfig::get_hls_fragment(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT_SECONDS("srs.vhost.hls.hls_fragment");
static srs_utime_t DEFAULT = 10 * SRS_UTIME_SECONDS; static srs_utime_t DEFAULT = 10 * SRS_UTIME_SECONDS;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6666,6 +6678,8 @@ srs_utime_t SrsConfig::get_hls_fragment(string vhost)
double SrsConfig::get_hls_td_ratio(string vhost) double SrsConfig::get_hls_td_ratio(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT("srs.vhost.hls.hls_td_ratio");
static double DEFAULT = 1.5; static double DEFAULT = 1.5;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6683,6 +6697,8 @@ double SrsConfig::get_hls_td_ratio(string vhost)
double SrsConfig::get_hls_aof_ratio(string vhost) double SrsConfig::get_hls_aof_ratio(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT("srs.vhost.hls.hls_aof_ratio");
static double DEFAULT = 2.0; static double DEFAULT = 2.0;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6700,6 +6716,8 @@ double SrsConfig::get_hls_aof_ratio(string vhost)
srs_utime_t SrsConfig::get_hls_window(string vhost) srs_utime_t SrsConfig::get_hls_window(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT_SECONDS("srs.vhost.hls.hls_window");
static srs_utime_t DEFAULT = (60 * SRS_UTIME_SECONDS); static srs_utime_t DEFAULT = (60 * SRS_UTIME_SECONDS);
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6717,6 +6735,8 @@ srs_utime_t SrsConfig::get_hls_window(string vhost)
string SrsConfig::get_hls_on_error(string vhost) string SrsConfig::get_hls_on_error(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_on_error");
// try to ignore the error. // try to ignore the error.
static string DEFAULT = "continue"; static string DEFAULT = "continue";
@ -6735,6 +6755,8 @@ string SrsConfig::get_hls_on_error(string vhost)
string SrsConfig::get_hls_acodec(string vhost) string SrsConfig::get_hls_acodec(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_acodec");
static string DEFAULT = "aac"; static string DEFAULT = "aac";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6752,6 +6774,8 @@ string SrsConfig::get_hls_acodec(string vhost)
string SrsConfig::get_hls_vcodec(string vhost) string SrsConfig::get_hls_vcodec(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_vcodec");
static string DEFAULT = "h264"; static string DEFAULT = "h264";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6769,6 +6793,8 @@ string SrsConfig::get_hls_vcodec(string vhost)
int SrsConfig::get_vhost_hls_nb_notify(string vhost) int SrsConfig::get_vhost_hls_nb_notify(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_INT("srs.vhost.hls.hls_nb_notify");
static int DEFAULT = 64; static int DEFAULT = 64;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6786,6 +6812,8 @@ int SrsConfig::get_vhost_hls_nb_notify(string vhost)
bool SrsConfig::get_vhost_hls_dts_directly(string vhost) bool SrsConfig::get_vhost_hls_dts_directly(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_dts_directly");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6803,6 +6831,8 @@ bool SrsConfig::get_vhost_hls_dts_directly(string vhost)
bool SrsConfig::get_hls_ctx_enabled(std::string vhost) bool SrsConfig::get_hls_ctx_enabled(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_ctx");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6820,6 +6850,8 @@ bool SrsConfig::get_hls_ctx_enabled(std::string vhost)
bool SrsConfig::get_hls_ts_ctx_enabled(std::string vhost) bool SrsConfig::get_hls_ts_ctx_enabled(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_ts_ctx");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6837,6 +6869,8 @@ bool SrsConfig::get_hls_ts_ctx_enabled(std::string vhost)
bool SrsConfig::get_hls_cleanup(string vhost) bool SrsConfig::get_hls_cleanup(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_cleanup");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6854,6 +6888,8 @@ bool SrsConfig::get_hls_cleanup(string vhost)
srs_utime_t SrsConfig::get_hls_dispose(string vhost) srs_utime_t SrsConfig::get_hls_dispose(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_SECONDS("srs.vhost.hls.hls_dispose");
static srs_utime_t DEFAULT = 0; static srs_utime_t DEFAULT = 0;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6871,6 +6907,8 @@ srs_utime_t SrsConfig::get_hls_dispose(string vhost)
bool SrsConfig::get_hls_wait_keyframe(string vhost) bool SrsConfig::get_hls_wait_keyframe(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_wait_keyframe");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6888,6 +6926,8 @@ bool SrsConfig::get_hls_wait_keyframe(string vhost)
bool SrsConfig::get_hls_keys(string vhost) bool SrsConfig::get_hls_keys(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.hls.hls_keys");
static bool DEFAULT = false; static bool DEFAULT = false;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6905,6 +6945,8 @@ bool SrsConfig::get_hls_keys(string vhost)
int SrsConfig::get_hls_fragments_per_key(string vhost) int SrsConfig::get_hls_fragments_per_key(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_INT("srs.vhost.hls.hls_fragments_per_key");
static int DEFAULT = 5; static int DEFAULT = 5;
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6922,6 +6964,8 @@ int SrsConfig::get_hls_fragments_per_key(string vhost)
string SrsConfig::get_hls_key_file(string vhost) string SrsConfig::get_hls_key_file(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_key_file");
static string DEFAULT = "[app]/[stream]-[seq].key"; static string DEFAULT = "[app]/[stream]-[seq].key";
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
@ -6939,6 +6983,8 @@ string SrsConfig::get_hls_key_file(string vhost)
string SrsConfig::get_hls_key_file_path(std::string vhost) string SrsConfig::get_hls_key_file_path(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_key_file_path");
//put the key in ts path defaultly. //put the key in ts path defaultly.
static string DEFAULT = get_hls_path(vhost); static string DEFAULT = get_hls_path(vhost);
@ -6957,6 +7003,8 @@ string SrsConfig::get_hls_key_file_path(std::string vhost)
string SrsConfig::get_hls_key_url(std::string vhost) string SrsConfig::get_hls_key_url(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hls.hls_key_url");
//put the key in ts path defaultly. //put the key in ts path defaultly.
static string DEFAULT = get_hls_path(vhost); static string DEFAULT = get_hls_path(vhost);
@ -6986,6 +7034,8 @@ SrsConfDirective *SrsConfig::get_hds(const string &vhost)
bool SrsConfig::get_hds_enabled(const string &vhost) bool SrsConfig::get_hds_enabled(const string &vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.hds.enabled");
static bool DEFAULT = false; static bool DEFAULT = false;
SrsConfDirective* conf = get_vhost(vhost); SrsConfDirective* conf = get_vhost(vhost);
@ -7015,6 +7065,8 @@ bool SrsConfig::get_hds_enabled(SrsConfDirective* vhost)
string SrsConfig::get_hds_path(const string &vhost) string SrsConfig::get_hds_path(const string &vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.hds.hds_path");
static string DEFAULT = "./objs/nginx/html"; static string DEFAULT = "./objs/nginx/html";
SrsConfDirective* conf = get_hds(vhost); SrsConfDirective* conf = get_hds(vhost);
@ -7032,6 +7084,8 @@ string SrsConfig::get_hds_path(const string &vhost)
srs_utime_t SrsConfig::get_hds_fragment(const string &vhost) srs_utime_t SrsConfig::get_hds_fragment(const string &vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT_SECONDS("srs.vhost.hds.hds_fragment");
static srs_utime_t DEFAULT = (10 * SRS_UTIME_SECONDS); static srs_utime_t DEFAULT = (10 * SRS_UTIME_SECONDS);
SrsConfDirective* conf = get_hds(vhost); SrsConfDirective* conf = get_hds(vhost);
@ -7049,6 +7103,8 @@ srs_utime_t SrsConfig::get_hds_fragment(const string &vhost)
srs_utime_t SrsConfig::get_hds_window(const string &vhost) srs_utime_t SrsConfig::get_hds_window(const string &vhost)
{ {
SRS_OVERWRITE_BY_ENV_FLOAT_SECONDS("srs.vhost.hds.hds_window");
static srs_utime_t DEFAULT = (60 * SRS_UTIME_SECONDS); static srs_utime_t DEFAULT = (60 * SRS_UTIME_SECONDS);
SrsConfDirective* conf = get_hds(vhost); SrsConfDirective* conf = get_hds(vhost);
@ -7076,6 +7132,8 @@ SrsConfDirective* SrsConfig::get_dvr(string vhost)
bool SrsConfig::get_dvr_enabled(string vhost) bool SrsConfig::get_dvr_enabled(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.dvr.enabled");
static bool DEFAULT = false; static bool DEFAULT = false;
SrsConfDirective* conf = get_vhost(vhost); SrsConfDirective* conf = get_vhost(vhost);
@ -7116,11 +7174,12 @@ SrsConfDirective* SrsConfig::get_dvr_apply(string vhost)
} }
return conf; return conf;
} }
string SrsConfig::get_dvr_path(string vhost) string SrsConfig::get_dvr_path(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.dvr.dvr_path");
static string DEFAULT = "./objs/nginx/html/[app]/[stream].[timestamp].flv"; static string DEFAULT = "./objs/nginx/html/[app]/[stream].[timestamp].flv";
SrsConfDirective* conf = get_dvr(vhost); SrsConfDirective* conf = get_dvr(vhost);
@ -7138,6 +7197,8 @@ string SrsConfig::get_dvr_path(string vhost)
string SrsConfig::get_dvr_plan(string vhost) string SrsConfig::get_dvr_plan(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_STRING("srs.vhost.dvr.dvr_plan");
static string DEFAULT = "session"; static string DEFAULT = "session";
SrsConfDirective* conf = get_dvr(vhost); SrsConfDirective* conf = get_dvr(vhost);
@ -7155,6 +7216,8 @@ string SrsConfig::get_dvr_plan(string vhost)
srs_utime_t SrsConfig::get_dvr_duration(string vhost) srs_utime_t SrsConfig::get_dvr_duration(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_SECONDS("srs.vhost.dvr.dvr_duration");
static srs_utime_t DEFAULT = 30 * SRS_UTIME_SECONDS; static srs_utime_t DEFAULT = 30 * SRS_UTIME_SECONDS;
SrsConfDirective* conf = get_dvr(vhost); SrsConfDirective* conf = get_dvr(vhost);
@ -7172,6 +7235,8 @@ srs_utime_t SrsConfig::get_dvr_duration(string vhost)
bool SrsConfig::get_dvr_wait_keyframe(string vhost) bool SrsConfig::get_dvr_wait_keyframe(string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL2("srs.vhost.dvr.dvr_wait_keyframe");
static bool DEFAULT = true; static bool DEFAULT = true;
SrsConfDirective* conf = get_dvr(vhost); SrsConfDirective* conf = get_dvr(vhost);
@ -7189,6 +7254,10 @@ bool SrsConfig::get_dvr_wait_keyframe(string vhost)
int SrsConfig::get_dvr_time_jitter(string vhost) int SrsConfig::get_dvr_time_jitter(string vhost)
{ {
if (!srs_getenv("srs.vhost.dvr.dvr_wait_keyframe").empty()) {
return srs_time_jitter_string2int(srs_getenv("srs.vhost.dvr.dvr_wait_keyframe"));
}
static string DEFAULT = "full"; static string DEFAULT = "full";
SrsConfDirective* conf = get_dvr(vhost); SrsConfDirective* conf = get_dvr(vhost);
@ -7705,7 +7774,7 @@ SrsConfDirective* SrsConfig::get_srt(std::string vhost)
bool SrsConfig::get_srt_enabled(std::string vhost) bool SrsConfig::get_srt_enabled(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL("srs.srt.enabled"); SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.srt.enabled");
static bool DEFAULT = false; static bool DEFAULT = false;
@ -7725,7 +7794,7 @@ bool SrsConfig::get_srt_enabled(std::string vhost)
bool SrsConfig::get_srt_to_rtmp(std::string vhost) bool SrsConfig::get_srt_to_rtmp(std::string vhost)
{ {
SRS_OVERWRITE_BY_ENV_BOOL("srs.srt.srt_to_rtmp"); SRS_OVERWRITE_BY_ENV_BOOL("srs.vhost.srt.srt_to_rtmp");
static bool DEFAULT = true; static bool DEFAULT = true;

Loading…
Cancel
Save