[FFmpeg-cvslog] hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size

Martin Storsjö git at videolan.org
Thu Jul 4 23:35:31 EEST 2024


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Jun 20 16:33:18 2024 +0300| [52f57568d5ed036aca5ee4259c69e7c1476b6d66] | committer: Martin Storsjö

hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size

When not using HLS_SINGLE_FILE or hls_segment_size, we're writing
each segment into a separate file. In that case, the file start pos for
each segment will be zero.

This matches the case in (hls->max_seg_size > 0) above, where we
decide to switch to a new file.

This fixes the calculation of "vs->size = new_start_pos - vs->start_pos"
at the start of hls_write_packet; previously, start_pos would
refer to the byte size of the previous segment file, giving
vs->size entirely bogus values here.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52f57568d5ed036aca5ee4259c69e7c1476b6d66
---

 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3d5eb47e84..0c72774e29 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2659,7 +2659,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                 vs->start_pos = new_start_pos;
             }
         } else {
-            vs->start_pos = new_start_pos;
+            vs->start_pos = 0;
             sls_flag_file_rename(hls, vs, old_filename);
             ret = hls_start(s, vs);
         }



More information about the ffmpeg-cvslog mailing list