[FFmpeg-cvslog] avutil/hwcontext_cuda: return more useful error codes from init functions
Timo Rothenpieler
git at videolan.org
Tue Nov 23 00:31:52 EET 2021
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Mon Nov 22 22:50:08 2021 +0100| [2de6cd4ba450b40b2a60240d38a017b3dbbb18b9] | committer: Timo Rothenpieler
avutil/hwcontext_cuda: return more useful error codes from init functions
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2de6cd4ba450b40b2a60240d38a017b3dbbb18b9
---
libavutil/hwcontext_cuda.c | 18 +++++++++++-------
1 file 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 = {
More information about the ffmpeg-cvslog
mailing list