diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2020-05-29 11:39:05 +0800 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-06-14 21:04:45 +0200 |
commit | e929799065413381b049f0707386796beeafb4a4 (patch) | |
tree | abf94ab036faa3ca7efe65f7d27d3579f64c0415 | |
parent | 0c37321362a1d359f555cbc65ebcc9770628311e (diff) | |
download | ffmpeg-e929799065413381b049f0707386796beeafb4a4.tar.gz |
avformat/hls: check segment duration value of EXTINF
fix ticket: 8673
set the default EXTINF duration to 1ms if duration is smaller than 1ms
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 9dfb19baeb86a8bb02c53a441682c6e9a6e104cc)
-rw-r--r-- | libavformat/hls.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c index 3ca6b90b19..17b3dd545d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -894,8 +894,6 @@ static int parse_playlist(HLSContext *c, const char *url, ret = AVERROR(ENOMEM); goto fail; } - seg->duration = duration; - seg->key_type = key_type; if (has_iv) { memcpy(seg->iv, iv, sizeof(iv)); } else { @@ -937,6 +935,13 @@ static int parse_playlist(HLSContext *c, const char *url, goto fail; } + if (duration < 0.001 * AV_TIME_BASE) { + av_log(c->ctx, AV_LOG_WARNING, "Cannot get correct #EXTINF value of segment %s," + " set to default value to 1ms.\n", seg->url); + duration = 0.001 * AV_TIME_BASE; + } + seg->duration = duration; + seg->key_type = key_type; dynarray_add(&pls->segments, &pls->n_segments, seg); is_segment = 0; |