aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/hwcontext_cuda.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2021-11-22 22:50:08 +0100
committerTimo Rothenpieler <timo@rothenpieler.org>2021-11-22 23:03:21 +0100
commit2de6cd4ba450b40b2a60240d38a017b3dbbb18b9 (patch)
treea40c97c64e78bb565eb0b999877c9f8e4190e8d3 /libavutil/hwcontext_cuda.c
parentb1f1de084416768e8b4ba76b338029b974e518a2 (diff)
downloadffmpeg-2de6cd4ba450b40b2a60240d38a017b3dbbb18b9.tar.gz
avutil/hwcontext_cuda: return more useful error codes from init functions
Diffstat (limited to 'libavutil/hwcontext_cuda.c')
-rw-r--r--libavutil/hwcontext_cuda.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index ed7eeecb8b..b96460920f 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -402,12 +402,13 @@ static int cuda_device_create(AVHWDeviceContext *device_ctx,
ret = cuda_flags_from_opts(device_ctx, opts, &flags);
if (ret < 0)
- return ret;
+ goto error;
if (device)
device_idx = strtol(device, NULL, 0);
- if (cuda_device_init(device_ctx) < 0)
+ ret = cuda_device_init(device_ctx);
+ if (ret < 0)
goto error;
cu = hwctx->internal->cuda_dl;
@@ -428,7 +429,7 @@ static int cuda_device_create(AVHWDeviceContext *device_ctx,
error:
cuda_device_uninit(device_ctx);
- return AVERROR_UNKNOWN;
+ return ret;
}
static int cuda_device_derive(AVHWDeviceContext *device_ctx,
@@ -441,7 +442,7 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
ret = cuda_flags_from_opts(device_ctx, opts, &flags);
if (ret < 0)
- return ret;
+ goto error;
#if CONFIG_VULKAN
VkPhysicalDeviceIDProperties vk_idp = {
@@ -466,16 +467,19 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
#undef TYPE
#endif
default:
- return AVERROR(ENOSYS);
+ ret = AVERROR(ENOSYS);
+ goto error;
}
if (!src_uuid) {
av_log(device_ctx, AV_LOG_ERROR,
"Failed to get UUID of source device.\n");
+ ret = AVERROR(EINVAL);
goto error;
}
- if (cuda_device_init(device_ctx) < 0)
+ ret = cuda_device_init(device_ctx);
+ if (ret < 0)
goto error;
cu = hwctx->internal->cuda_dl;
@@ -520,7 +524,7 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
error:
cuda_device_uninit(device_ctx);
- return AVERROR_UNKNOWN;
+ return ret;
}
const HWContextType ff_hwcontext_type_cuda = {