aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuta Gadkari <rgadkari@nvidia.com>2019-05-03 13:41:11 +0530
committerBtbN <btbn@btbn.de>2019-05-08 11:40:06 +0200
commit80155795bb433fe588a957be9fb96a0a2608a00f (patch)
treedd7f78f0d17b9da01a240d1169048f2f57d4a246
parent06ba4783a0ba331153b71993bc1908958d483c2d (diff)
downloadffmpeg-80155795bb433fe588a957be9fb96a0a2608a00f.tar.gz
avcodec/cuviddec: add capability check for maximum macroblock count
Cuvid supports clips with a limit on maximum number of macroblocks. This check was missing after cuvidGetDecoderCaps API call allowing unsupported clips to proceed. Added the missing check, same as the one in hwaccel nvdec implementation. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r--libavcodec/cuviddec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index d59d1faf9e..acee78cf2c 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -805,6 +805,12 @@ static int cuvid_test_capabilities(AVCodecContext *avctx,
return AVERROR(EINVAL);
}
+ if ((probed_width * probed_height) / 256 > caps->nMaxMBCount) {
+ av_log(avctx, AV_LOG_ERROR, "Video macroblock count %d exceeds maximum of %d\n",
+ (int)(probed_width * probed_height) / 256, caps->nMaxMBCount);
+ return AVERROR(EINVAL);
+ }
+
return 0;
}