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 v6.0.87 (#3824)
1. The comment on the ratio configuration says it can affect the slice duration, but there is no effect after configuring it. 2. The default hls_td_ratio is 1.5, and after setting it to 1, the duration is still slightly more than 10 seconds. 3. Even if the GOP is an integer, like 1 second, the slice is still a non-integer, like 0.998 seconds, which seems a bit unreliable. 4. In the duration of the TS in the m3u8 file, it is one frame less than the duration of the slice. 5. Set hls_dispose to 120s to dispose HLS files when no stream. 6. Use docker.conf for docker. Before this patch: ``` #EXTINF:10.983, no desc livestream-0.ts?hls_ctx=3p095hq0 ``` After this patch: ``` #EXTINF:10.000, no desc livestream-0.ts?hls_ctx=3p095hq0 ``` Note: If the fragment is set to 10 seconds, but the GOP size cannot be divided by 10, such as not 1, 2, 5, or 10, then the duration of ts will still be more than 10 seconds. --------- Co-authored-by: john <hondaxiao@tencent.com>
This commit is contained in:
parent
d10e16e335
commit
a1e4f61dd3
11 changed files with 87 additions and 63 deletions
|
@ -6973,7 +6973,7 @@ double SrsConfig::get_hls_td_ratio(string vhost)
|
|||
{
|
||||
SRS_OVERWRITE_BY_ENV_FLOAT("srs.vhost.hls.hls_td_ratio"); // SRS_VHOST_HLS_HLS_TD_RATIO
|
||||
|
||||
static double DEFAULT = 1.5;
|
||||
static double DEFAULT = 1.0;
|
||||
|
||||
SrsConfDirective* conf = get_hls(vhost);
|
||||
if (!conf) {
|
||||
|
@ -6992,7 +6992,7 @@ double SrsConfig::get_hls_aof_ratio(string vhost)
|
|||
{
|
||||
SRS_OVERWRITE_BY_ENV_FLOAT("srs.vhost.hls.hls_aof_ratio"); // SRS_VHOST_HLS_HLS_AOF_RATIO
|
||||
|
||||
static double DEFAULT = 2.0;
|
||||
static double DEFAULT = 1.2;
|
||||
|
||||
SrsConfDirective* conf = get_hls(vhost);
|
||||
if (!conf) {
|
||||
|
@ -7183,7 +7183,7 @@ srs_utime_t SrsConfig::get_hls_dispose(string vhost)
|
|||
{
|
||||
SRS_OVERWRITE_BY_ENV_SECONDS("srs.vhost.hls.hls_dispose"); // SRS_VHOST_HLS_HLS_DISPOSE
|
||||
|
||||
static srs_utime_t DEFAULT = 0;
|
||||
static srs_utime_t DEFAULT = 120 * SRS_UTIME_SECONDS;
|
||||
|
||||
SrsConfDirective* conf = get_hls(vhost);
|
||||
if (!conf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue