mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Solve the problem of inaccurate HLS TS duration. v5.0.187 (#3824)
This commit is contained in:
parent
8b80566f78
commit
75c9c5a849
10 changed files with 84 additions and 62 deletions
|
@ -1747,27 +1747,6 @@ vhost hls.srs.com {
|
|||
# default: off
|
||||
enabled on;
|
||||
|
||||
# Whether enable hls_ctx for HLS streaming, for which we create a "fake" connection for HTTP API and callback.
|
||||
# For each HLS streaming session, we use a child m3u8 with a session identified by query "hls_ctx", it simply
|
||||
# work as the session id.
|
||||
# Once the HLS streaming session is created, we will cleanup it when timeout in 2*hls_window seconds. So it
|
||||
# takes a long time period to identify the timeout.
|
||||
# Now we got a HLS stremaing session, just like RTMP/WebRTC/HTTP-FLV streaming, we're able to stat the session
|
||||
# as a "fake" connection, do HTTP callback when start playing the HLS streaming. You're able to do querying and
|
||||
# authentication.
|
||||
# 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
|
||||
hls_ctx on;
|
||||
# For HLS pseudo streaming, whether enable the session for each TS segment.
|
||||
# If enabled, SRS HTTP API will show the statistics about HLS streaming bandwidth, both m3u8 and ts file. Please
|
||||
# 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.
|
||||
# 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
|
||||
hls_ts_ctx on;
|
||||
|
||||
# the hls fragment in seconds, the duration of a piece of ts.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_FRAGMENT for all vhosts.
|
||||
# default: 10
|
||||
|
@ -1776,15 +1755,15 @@ vhost hls.srs.com {
|
|||
# EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
|
||||
# EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_TD_RATIO for all vhosts.
|
||||
# default: 1.5
|
||||
hls_td_ratio 1.5;
|
||||
# default: 1.0
|
||||
hls_td_ratio 1.0;
|
||||
# the audio overflow ratio.
|
||||
# for pure audio, the duration to reap the segment.
|
||||
# for example, the hls_fragment is 10s, hls_aof_ratio is 2.0,
|
||||
# the segment will reap to 20s for pure audio.
|
||||
# for example, the hls_fragment is 10s, hls_aof_ratio is 1.2,
|
||||
# the segment will reap to 12s for pure audio.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_AOF_RATIO for all vhosts.
|
||||
# default: 2.0
|
||||
hls_aof_ratio 2.0;
|
||||
# default: 1.2
|
||||
hls_aof_ratio 1.2;
|
||||
# the hls window in seconds, the number of ts in m3u8.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_WINDOW for all vhosts.
|
||||
# default: 60
|
||||
|
@ -1833,13 +1812,6 @@ vhost hls.srs.com {
|
|||
# Overwrite by env SRS_VHOST_HLS_HLS_TS_FILE for all vhosts.
|
||||
# default: [app]/[stream]-[seq].ts
|
||||
hls_ts_file [app]/[stream]-[seq].ts;
|
||||
# whether use floor for the hls_ts_file path generation.
|
||||
# if on, use floor(timestamp/hls_fragment) as the variable [timestamp],
|
||||
# and use enhanced algorithm to calc deviation for segment.
|
||||
# @remark when floor on, recommend the hls_segment>=2*gop.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_TS_FLOOR for all vhosts.
|
||||
# default: off
|
||||
hls_ts_floor off;
|
||||
# the hls entry prefix, which is base url of ts url.
|
||||
# for example, the prefix is:
|
||||
# http://your-server/
|
||||
|
@ -1875,20 +1847,48 @@ vhost hls.srs.com {
|
|||
# @remark 0 to disable dispose for publisher.
|
||||
# @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
|
||||
hls_dispose 0;
|
||||
# the max size to notify hls,
|
||||
# to read max bytes from ts of specified cdn network,
|
||||
# @remark only used when on_hls_notify is config.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_NB_NOTIFY for all vhosts.
|
||||
# default: 64
|
||||
hls_nb_notify 64;
|
||||
# default: 120
|
||||
hls_dispose 120;
|
||||
# whether wait keyframe to reap segment,
|
||||
# if off, reap segment when duration exceed the fragment,
|
||||
# if on, reap segment when duration exceed and got keyframe.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_WAIT_KEYFRAME for all vhosts.
|
||||
# default: on
|
||||
hls_wait_keyframe on;
|
||||
# whether use floor for the hls_ts_file path generation.
|
||||
# if on, use floor(timestamp/hls_fragment) as the variable [timestamp],
|
||||
# and use enhanced algorithm to calc deviation for segment.
|
||||
# @remark when floor on, recommend the hls_segment>=2*gop.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_TS_FLOOR for all vhosts.
|
||||
# default: off
|
||||
hls_ts_floor off;
|
||||
# the max size to notify hls,
|
||||
# to read max bytes from ts of specified cdn network,
|
||||
# @remark only used when on_hls_notify is config.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_NB_NOTIFY for all vhosts.
|
||||
# default: 64
|
||||
hls_nb_notify 64;
|
||||
|
||||
# Whether enable hls_ctx for HLS streaming, for which we create a "fake" connection for HTTP API and callback.
|
||||
# For each HLS streaming session, we use a child m3u8 with a session identified by query "hls_ctx", it simply
|
||||
# work as the session id.
|
||||
# Once the HLS streaming session is created, we will cleanup it when timeout in 2*hls_window seconds. So it
|
||||
# takes a long time period to identify the timeout.
|
||||
# Now we got a HLS stremaing session, just like RTMP/WebRTC/HTTP-FLV streaming, we're able to stat the session
|
||||
# as a "fake" connection, do HTTP callback when start playing the HLS streaming. You're able to do querying and
|
||||
# authentication.
|
||||
# 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
|
||||
hls_ctx on;
|
||||
# For HLS pseudo streaming, whether enable the session for each TS segment.
|
||||
# If enabled, SRS HTTP API will show the statistics about HLS streaming bandwidth, both m3u8 and ts file. Please
|
||||
# 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.
|
||||
# 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
|
||||
hls_ts_ctx on;
|
||||
|
||||
# whether using AES encryption.
|
||||
# Overwrite by env SRS_VHOST_HLS_HLS_KEYS for all vhosts.
|
||||
|
|
|
@ -12,6 +12,7 @@ vhost __defaultVhost__ {
|
|||
enabled on;
|
||||
# Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
|
||||
hls_ctx off;
|
||||
hls_ts_ctx off;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@ http_server {
|
|||
vhost __defaultVhost__ {
|
||||
hls {
|
||||
enabled on;
|
||||
hls_fragment 0.2;
|
||||
hls_window 2;
|
||||
hls_wait_keyframe off;
|
||||
hls_fragment 2;
|
||||
hls_window 10;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue