[FFmpeg-devel] [PATCH] avformat/hlsenc: check duration value correct before split segment
Steven Liu
lq at chinaffmpeg.org
Mon Aug 17 12:53:37 EEST 2020
fix ticket: 8847
check the timestamps of current packets minus last segment end_pts
if the duration is negative, plus the places where the muxer should split.
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
libavformat/hlsenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cb31d6aed7..3564c68732 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2398,9 +2398,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
vs->duration = (double)(pkt->pts - vs->end_pts) * st->time_base.num / st->time_base.den;
}
}
-
}
+ can_split = pkt->pts - vs->end_pts < 0 ? 0 : 1;
if (vs->packets_written && can_split && av_compare_ts(pkt->pts - vs->start_pts, st->time_base,
end_pts, AV_TIME_BASE_Q) >= 0) {
int64_t new_start_pos;
--
2.25.0
More information about the ffmpeg-devel
mailing list