From 518b49a735ff0b7df0a5970526a81f8590a7a242 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 13 Jul 2023 15:11:07 +0200 Subject: [PATCH] fftools/ffmpeg_dec: return error codes from dec_packet() instead of aborting --- 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; } }