Skip to content

Commit

Permalink
avformat/hls: check segment duration value of EXTINF
Browse files Browse the repository at this point in the history
fix ticket: 8673
set the default EXTINF duration to 1ms if duration is smaller than 1ms

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
  • Loading branch information
T-bagwell committed Jun 10, 2020
1 parent ea1940c commit 9dfb19b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libavformat/hls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9dfb19b

Please sign in to comment.