From ab3be5fa1893bf1756627e1646b065c41e69336a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 3 Jun 2021 20:40:16 +0200 Subject: Ignore errors from avcodec_receive_frame when flushing video (#2035). The test fails if we don't do this; it doesn't really seem 100% convincing but we are already doing this for audio. --- src/lib/ffmpeg_decoder.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index db88562ea..c5c41fdac 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -548,9 +548,13 @@ FFmpegDecoder::decode_and_process_video_packet (AVPacket* packet) } r = avcodec_receive_frame (context, _frame); - if (r == AVERROR(EAGAIN) || r == AVERROR_EOF) { - /* More input is required, or no more frames are coming */ + if (r == AVERROR(EAGAIN) || r == AVERROR_EOF || (r < 0 && !packet)) { + /* More input is required, no more frames are coming, or we are flushing and there was + * some error which we just want to ignore. + */ return false; + } else if (r < 0) { + throw DecodeError (N_("avcodec_receive_frame"), N_("FFmpeg::decode_and_process_video_packet"), r); } /* We assume we'll only get one frame here, which I think is safe */ -- cgit v1.2.3