1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Steven Liu 2020-05-29 11:39:05 +08:00
parent ea1940c6e2
commit 9dfb19baeb

View File

@ -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,
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;