diff mbox series

[FFmpeg-devel] avformat/hlsenc: hls output optimisation Currently the output of the segment is delayed by 1 packet since the check condition compares the pts of the beginning of packet insted of its end to the end_pts of the segment.

Message ID 20210107200408.46389-1-bartekziemski@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/hlsenc: hls output optimisation Currently the output of the segment is delayed by 1 packet since the check condition compares the pts of the beginning of packet insted of its end to the end_pts of the segment.
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Bartosz Ziemski Jan. 7, 2021, 8:04 p.m. UTC
From: Bartosz Ziemski <bz@nativewaves.com>

Signed-off-by: Bartosz Ziemski <bartekziemski@gmail.com>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cafe0e8c69..bac1e681f3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2497,7 +2497,7 @@  static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     can_split = can_split && (pkt->pts - vs->end_pts > 0);
-    if (vs->packets_written && can_split && av_compare_ts(pkt->pts - vs->start_pts, st->time_base,
+    if (vs->packets_written && can_split && av_compare_ts(pkt->pts + pkt->duration - vs->start_pts, st->time_base,
                                                           end_pts, AV_TIME_BASE_Q) >= 0) {
         int64_t new_start_pos;
         int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);