diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-06-03 20:40:16 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-06-03 20:40:16 +0200 |
| commit | ab3be5fa1893bf1756627e1646b065c41e69336a (patch) | |
| tree | e9a768d04b974dfa1889d2a2a270f0283fea239c /src/lib/ffmpeg_decoder.cc | |
| parent | 56062a84cca360881bfa3bd2b2254d451223d775 (diff) | |
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.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 8 |
1 files changed, 6 insertions, 2 deletions
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 */ |
