[FFmpeg-devel] [PATCH 42/49] fftools/ffmpeg_mux: simplify submit_packet()

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


---
 fftools/ffmpeg_mux.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 37ae61fee8..2cdbd5feef 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -258,18 +258,14 @@ static int submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
 {
     int ret;
 
-    if (of->mux->header_written) {
+    if (of->mux->header_written)
         return write_packet(of, ost, pkt);
-    } else {
-        /* the muxer is not initialized yet, buffer the packet */
-        ret = queue_packet(of, ost, pkt);
-        if (ret < 0) {
-            av_packet_unref(pkt);
-            return ret;
-        }
-    }
 
-    return 0;
+    /* the muxer is not initialized yet, buffer the packet */
+    ret = queue_packet(of, ost, pkt);
+    if (ret < 0)
+        av_packet_unref(pkt);
+    return ret;
 }
 
 int of_submit_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
-- 
2.34.1



More information about the ffmpeg-devel mailing list