[FFmpeg-devel] [PATCH 2/3] ffmpeg: exit_on_error if decoding a packet failed

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Jun 30 21:31:49 CEST 2015


This is the second part of the fix for ticket #4370.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 ffmpeg.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index aac03bb..e3d0cc4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1873,6 +1873,9 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
     if (*got_output || ret<0 || pkt->size)
         decode_error_stat[ret<0] ++;
 
+    if (ret < 0 && exit_on_error)
+        exit_program(1);
+
     if (!*got_output || ret < 0)
         return ret;
 
@@ -2009,6 +2012,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
     if (*got_output || ret<0 || pkt->size)
         decode_error_stat[ret<0] ++;
 
+    if (ret < 0 && exit_on_error)
+        exit_program(1);
+
     if (*got_output && ret >= 0) {
         if (ist->dec_ctx->width  != decoded_frame->width ||
             ist->dec_ctx->height != decoded_frame->height ||
@@ -2118,6 +2124,9 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
     if (*got_output || ret<0 || pkt->size)
         decode_error_stat[ret<0] ++;
 
+    if (ret < 0 && exit_on_error)
+        exit_program(1);
+
     if (ret < 0 || !*got_output) {
         if (!pkt->size)
             sub2video_flush(ist);
-- 
2.1.4


More information about the ffmpeg-devel mailing list