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

Anton Khirnov anton at khirnov.net
Mon Apr 4 14:30:28 EEST 2022


---
 fftools/ffmpeg_mux.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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;
 }
-- 
2.34.1



More information about the ffmpeg-devel mailing list