[FFmpeg-devel] [PATCH] avformat/hlsenc: refine error message when retry with new http session

Steven Liu lq at chinaffmpeg.org
Sun Jul 7 11:49:20 EEST 2024


Fix CID: 1609624
The hlsenc should give error message when hlsenc_io_open error, release
memory of filename and options, should return warning message when
hlsenc_io_close error.

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/hlsenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 274de00f9a..494875bc3c 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2617,8 +2617,17 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                            " will retry with a new http session.\n");
                     ff_format_io_close(s, &vs->out);
                     ret = hlsenc_io_open(s, &vs->out, filename, &options);
+                    if (ret < 0) {
+                        av_log(s, hls->ignore_io_errors ? AV_LOG_WARNING : AV_LOG_ERROR,
+                            "Failed to open file '%s'\n", filename);
+                        av_freep(&filename);
+                        av_dict_free(&options);
+                        return hls->ignore_io_errors ? 0 : ret;
+                    }
                     reflush_dynbuf(vs, &range_length);
                     ret = hlsenc_io_close(s, &vs->out, filename);
+                    if (ret < 0)
+                        av_log(s, AV_LOG_WARNING, "Failed retry upload file '%s' with new http session.\n", oc->url);
                 }
                 av_dict_free(&options);
                 av_freep(&vs->temp_buffer);
-- 
2.43.0



More information about the ffmpeg-devel mailing list