From: Jan Ekström <jan.ekst...@24i.com>

Otherwise each new attempt will leave its connection open.

Signed-off-by: Jan Ekström <jan.ekst...@24i.com>
---
 libavformat/fifo.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 9fc524adbdf..bc363e458cd 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -142,8 +142,14 @@ static int fifo_thread_write_header(FifoThreadContext *ctx)
         avf2->streams[i]->cur_dts = 0;
 
     ret = avformat_write_header(avf2, &format_options);
-    if (!ret)
-        ctx->header_written = 1;
+    if (ret < 0) {
+        av_log(avf2, AV_LOG_ERROR,
+               "Failed to write format header: %s\n", av_err2str(ret));
+        ff_format_io_close(avf2, &avf2->pb);
+        goto end;
+    }
+
+    ctx->header_written = 1;
 
     // Check for options unrecognized by underlying muxer
     if (format_options) {
-- 
2.29.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to