diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-07-09 20:08:13 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-07-25 17:23:29 +0200 |
commit | aa9d15d89bb4ee8a31607d3db1b8c5334eb88d2d (patch) | |
tree | 02f80e592be0df9e41909e186819aa0b94093781 | |
parent | c9edbe4af901e9bc9f05a62319637f9760df9a4a (diff) | |
download | ffmpeg-aa9d15d89bb4ee8a31607d3db1b8c5334eb88d2d.tar.gz |
qsvdec: avoid an infinite loop with no consumed data and no output
This is triggerable with the HEVC decoder. It is unclear yet whether the
bug is in the calling code or the MSDK, but it seems better to check for
this in any case.
-rw-r--r-- | libavcodec/qsvdec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index da9b082d09..489375cf7b 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -245,6 +245,13 @@ int ff_qsv_decode(AVCodecContext *avctx, QSVContext *q, return ff_qsv_error(ret); } + /* make sure we do not enter an infinite loop if the SDK + * did not consume any data and did not return anything */ + if (!sync && !bs.DataOffset) { + av_log(avctx, AV_LOG_WARNING, "A decode call did not consume any data\n"); + bs.DataOffset = avpkt->size; + } + if (sync) { QSVFrame *out_frame = find_frame(q, outsurf); |