diff mbox series

[FFmpeg-devel,40/49] fftools/ffmpeg_mux: return errors from submit_packet()

Message ID 20220404113037.13070-41-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/49] fftools/ffmpeg: drop an obsolete hack | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Anton Khirnov April 4, 2022, 11:30 a.m. UTC
---
 fftools/ffmpeg_mux.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 3ea7636380..69af2c8d46 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -253,7 +253,7 @@  static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
     }
 }
 
-static void submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
+static int submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
 {
     int ret;
 
@@ -264,9 +264,11 @@  static void submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
         ret = queue_packet(of, ost, pkt);
         if (ret < 0) {
             av_packet_unref(pkt);
-            exit_program(1);
+            return ret;
         }
     }
+
+    return 0;
 }
 
 int of_submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
@@ -290,10 +292,12 @@  int of_submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
             else if (ret < 0)
                 return ret;
 
-            submit_packet(of, pkt, output_streams[of->ost_index + ret]);
+            ret = submit_packet(of, pkt, output_streams[of->ost_index + ret]);
+            if (ret < 0)
+                return ret;
         }
     } else if (!eof)
-        submit_packet(of, pkt, ost);
+        return submit_packet(of, pkt, ost);
 
     return 0;
 }