[FFmpeg-cvslog] fftools/ffmpeg_dec: return error codes from dec_packet() instead of aborting

Anton Khirnov git at videolan.org
Thu Jul 20 21:56:46 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul 13 15:11:07 2023 +0200| [518b49a735ff0b7df0a5970526a81f8590a7a242] | committer: Anton Khirnov

fftools/ffmpeg_dec: return error codes from dec_packet() instead of aborting

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=518b49a735ff0b7df0a5970526a81f8590a7a242
---

 fftools/ffmpeg.c     | 5 ++++-
 fftools/ffmpeg_dec.c | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ddb011741a..b4ea52ac1d 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -814,8 +814,11 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
     int eof_reached = 0;
     int duration_exceeded;
 
-    if (ist->decoding_needed)
+    if (ist->decoding_needed) {
         ret = dec_packet(ist, pkt, no_eof);
+        if (ret < 0 && ret != AVERROR_EOF)
+            return ret;
+    }
     if (ret == AVERROR_EOF || (!pkt && !ist->decoding_needed))
         eof_reached = 1;
 
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 5c1b8888e9..f5f764b6fa 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -816,7 +816,7 @@ finish:
     }
     // non-EOF errors here are all fatal
     if (ret < 0 && ret != AVERROR_EOF)
-        report_and_exit(ret);
+        return ret;
 
     // signal EOF to our downstreams
     if (ist->dec->type == AVMEDIA_TYPE_SUBTITLE)
@@ -825,7 +825,7 @@ finish:
         ret = send_filter_eof(ist);
         if (ret < 0) {
             av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
-            exit_program(1);
+            return ret;
         }
     }
 



More information about the ffmpeg-cvslog mailing list