[FFmpeg-cvslog] avformat/hls: check segment duration value of EXTINF
Steven Liu
git at videolan.org
Tue Jul 7 21:41:33 EEST 2020
ffmpeg | branch: release/4.2 | Steven Liu <lq at chinaffmpeg.org> | Fri May 29 11:39:05 2020 +0800| [c00e881a450fc465e60f41bd47ea6396a87f3eef] | committer: Michael Niedermayer
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 at chinaffmpeg.org>
(cherry picked from commit 9dfb19baeb86a8bb02c53a441682c6e9a6e104cc)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c00e881a450fc465e60f41bd47ea6396a87f3eef
---
libavformat/hls.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 8c12fcef77..fb2af90b92 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -873,8 +873,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 {
@@ -904,6 +902,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;
More information about the ffmpeg-cvslog
mailing list