[FFmpeg-devel] [PATCH 2/4] avformat/nutenc: check return of write_headers()

Andriy Gelman andriy.gelman at gmail.com
Sun Nov 8 21:50:41 EET 2020


From: Andriy Gelman <andriy.gelman at gmail.com>

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---
 libavformat/nutenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 87adef6f7e..0646f72af2 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -988,8 +988,11 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
         data_size += sm_size;
     }
 
-    if (1LL << (20 + 3 * nut->header_rep_count) <= avio_tell(bc))
-        write_headers(s, bc);
+    if (1LL << (20 + 3 * nut->header_rep_count) <= avio_tell(bc)) {
+        ret = write_headers(s, bc);
+        if (ret < 0)
+            goto fail;
+    }
 
     if (key_frame && !(nus->last_flags & FLAG_KEY))
         store_sp = 1;
-- 
2.28.0



More information about the ffmpeg-devel mailing list