[FFmpeg-devel] [PATCH] lavc/cuvid: fail early if GPU can't handle given video resolution

pkoshevoy at gmail.com pkoshevoy at gmail.com
Mon Jan 2 03:00:59 EET 2017


From: Pavel Koshevoy <pkoshevoy at gmail.com>

NVDEC (CUVID) does not support unlimited video resolutions, so if the
resolution of the source is known it can be used during avcodec_open2
call to fail early, rather than failing later during
avcodec_send_packet call.

This problem surfaced when trying to decode 5120x2700 h246 video on
Geforce GT 730 -- avcodec_open2 succeeded but decoding failed.
---
 libavcodec/cuvid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 8fc713d..2e70b62 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -625,8 +625,8 @@ static int cuvid_test_dummy_decoder(AVCodecContext *avctx, CUVIDPARSERPARAMS *cu
     cuinfo.ChromaFormat = cudaVideoChromaFormat_420;
     cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12;
 
-    cuinfo.ulWidth = 1280;
-    cuinfo.ulHeight = 720;
+    cuinfo.ulWidth = avctx->coded_width ? avctx->coded_width : 1280;
+    cuinfo.ulHeight = avctx->coded_height ? avctx->coded_height : 720;
     cuinfo.ulTargetWidth = cuinfo.ulWidth;
     cuinfo.ulTargetHeight = cuinfo.ulHeight;
 
-- 
2.9.2



More information about the ffmpeg-devel mailing list