ffmpeg: exit_on_error if decoding a packet failed
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 30 Jun 2015 19:06:40 +0000 (21:06 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sun, 19 Jul 2015 07:42:22 +0000 (09:42 +0200)
This is the second part of the fix for ticket #4370.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit cd64ead8d96b2d2c300e0ac620fb82b17d6051bf)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Conflicts:
ffmpeg.c

ffmpeg.c

index ec67af3..1524ac2 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1877,6 +1877,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) {
         if (!pkt->size) {
             for (i = 0; i < ist->nb_filters; i++)
@@ -2022,6 +2025,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 ||
@@ -2140,6 +2146,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);