mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avutil/hwcontext_cuda: return more useful error codes from init functions
This commit is contained in:
parent
b1f1de0844
commit
2de6cd4ba4
@ -402,12 +402,13 @@ static int cuda_device_create(AVHWDeviceContext *device_ctx,
|
|||||||
|
|
||||||
ret = cuda_flags_from_opts(device_ctx, opts, &flags);
|
ret = cuda_flags_from_opts(device_ctx, opts, &flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto error;
|
||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
device_idx = strtol(device, NULL, 0);
|
device_idx = strtol(device, NULL, 0);
|
||||||
|
|
||||||
if (cuda_device_init(device_ctx) < 0)
|
ret = cuda_device_init(device_ctx);
|
||||||
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cu = hwctx->internal->cuda_dl;
|
cu = hwctx->internal->cuda_dl;
|
||||||
@ -428,7 +429,7 @@ static int cuda_device_create(AVHWDeviceContext *device_ctx,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
cuda_device_uninit(device_ctx);
|
cuda_device_uninit(device_ctx);
|
||||||
return AVERROR_UNKNOWN;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cuda_device_derive(AVHWDeviceContext *device_ctx,
|
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);
|
ret = cuda_flags_from_opts(device_ctx, opts, &flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto error;
|
||||||
|
|
||||||
#if CONFIG_VULKAN
|
#if CONFIG_VULKAN
|
||||||
VkPhysicalDeviceIDProperties vk_idp = {
|
VkPhysicalDeviceIDProperties vk_idp = {
|
||||||
@ -466,16 +467,19 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
|
|||||||
#undef TYPE
|
#undef TYPE
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return AVERROR(ENOSYS);
|
ret = AVERROR(ENOSYS);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src_uuid) {
|
if (!src_uuid) {
|
||||||
av_log(device_ctx, AV_LOG_ERROR,
|
av_log(device_ctx, AV_LOG_ERROR,
|
||||||
"Failed to get UUID of source device.\n");
|
"Failed to get UUID of source device.\n");
|
||||||
|
ret = AVERROR(EINVAL);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cuda_device_init(device_ctx) < 0)
|
ret = cuda_device_init(device_ctx);
|
||||||
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cu = hwctx->internal->cuda_dl;
|
cu = hwctx->internal->cuda_dl;
|
||||||
@ -520,7 +524,7 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
cuda_device_uninit(device_ctx);
|
cuda_device_uninit(device_ctx);
|
||||||
return AVERROR_UNKNOWN;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HWContextType ff_hwcontext_type_cuda = {
|
const HWContextType ff_hwcontext_type_cuda = {
|
||||||
|
Loading…
Reference in New Issue
Block a user