[FFmpeg-cvslog] avformat/hlsenc: correctly reset subtitle stream counter per-varstream

Timo Rothenpieler git at videolan.org
Fri Aug 16 21:30:20 EEST 2024


ffmpeg | branch: release/5.0 | Timo Rothenpieler <timo at rothenpieler.org> | Fri Aug 16 02:01:12 2024 +0200| [4810ff7d723b3b613a9df969fa1804ac659a7a8f] | committer: Timo Rothenpieler

avformat/hlsenc: correctly reset subtitle stream counter per-varstream

Without resetting it, if there was a previous set of varstreams with
subtitles, it would subtract from all the streams, leading to chaos and
segfaults when trying to access for example stream -1.

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

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

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index ef8973cea1..b5cd79464e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2405,7 +2405,6 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     int is_ref_pkt = 1;
     int ret = 0, can_split = 1, i, j;
     int stream_index = 0;
-    int subtitle_streams = 0;
     int range_length = 0;
     const char *proto = NULL;
     int use_temp_file = 0;
@@ -2413,6 +2412,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     char *old_filename = NULL;
 
     for (i = 0; i < hls->nb_varstreams; i++) {
+        int subtitle_streams = 0;
         vs = &hls->var_streams[i];
         for (j = 0; j < vs->nb_streams; j++) {
             if (vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {



More information about the ffmpeg-cvslog mailing list