aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2024-06-20 16:33:18 +0300
committerMartin Storsjö <martin@martin.st>2024-07-04 23:33:24 +0300
commit52f57568d5ed036aca5ee4259c69e7c1476b6d66 (patch)
treeb750ce2e066abc9499afc4497a97cfb269d8653f
parent01312fdfcfd6dd3c0ab079c49ba15bdbee71959e (diff)
downloadffmpeg-52f57568d5ed036aca5ee4259c69e7c1476b6d66.tar.gz
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@martin.st>
-rw-r--r--libavformat/hlsenc.c2
1 files changed, 1 insertions, 1 deletions
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);
}