Commit e9297990 authored by Steven Liu's avatar Steven Liu Committed by Marton Balint

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: 's avatarSteven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 9dfb19baeb86a8bb02c53a441682c6e9a6e104cc)
parent 0c373213
...@@ -894,8 +894,6 @@ static int parse_playlist(HLSContext *c, const char *url, ...@@ -894,8 +894,6 @@ static int parse_playlist(HLSContext *c, const char *url,
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
seg->duration = duration;
seg->key_type = key_type;
if (has_iv) { if (has_iv) {
memcpy(seg->iv, iv, sizeof(iv)); memcpy(seg->iv, iv, sizeof(iv));
} else { } else {
...@@ -937,6 +935,13 @@ static int parse_playlist(HLSContext *c, const char *url, ...@@ -937,6 +935,13 @@ static int parse_playlist(HLSContext *c, const char *url,
goto fail; 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); dynarray_add(&pls->segments, &pls->n_segments, seg);
is_segment = 0; is_segment = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment