This ensures that the format and dimensions are actually valid - previously this wasn't checked, so we would only fail when the user actually attempted to allocate an image. --- libavutil/hwcontext_opencl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 43b5c5ae0c..c29a521f07 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -1696,11 +1696,23 @@ static int opencl_frames_init_command_queue(AVHWFramesContext *hwfc) static int opencl_frames_init(AVHWFramesContext *hwfc) { if (!hwfc->pool) { + AVBufferRef *test_ref; + hwfc->internal->pool_internal = av_buffer_pool_init2(sizeof(cl_mem), hwfc, &opencl_pool_alloc, NULL); if (!hwfc->internal->pool_internal) return AVERROR(ENOMEM); + + test_ref = av_buffer_pool_get(hwfc->internal->pool_internal); + if (!test_ref) { + av_log(hwfc, AV_LOG_ERROR, "Unable to create %dx%d images " + "with format %s.\n", hwfc->width, hwfc->height, + av_get_pix_fmt_name(hwfc->sw_format)); + return AVERROR(EINVAL); + } + + av_buffer_unref(&test_ref); } return opencl_frames_init_command_queue(hwfc); -- 2.16.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel