[FFmpeg-devel] [PATCH 2/3] nvenc: check runtime 9.1 function ptrs before use
Timo Rothenpieler
timo at rothenpieler.org
Wed Jul 15 18:17:32 EEST 2020
On 15.07.2020 16:34, wangbin wrote:
> From: wang-bin <wbsecg1 at gmail.com>
>
> ---
> libavcodec/nvenc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index ac35cb9f48..cec59f02f3 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -140,7 +140,7 @@ static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
> NvencContext *ctx = avctx->priv_data;
> NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
>
> - if (p_nvenc && ctx->nvencoder)
> + if (p_nvenc && ctx->nvencoder && p_nvenc->nvEncGetLastErrorString)
> details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder);
> #endif
>
> @@ -1353,7 +1353,7 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
> }
>
> #ifdef NVENC_HAVE_CUSTREAM_PTR
> - if (ctx->cu_context) {
> + if (ctx->cu_context && p_nvenc->nvEncSetIOCudaStreams) {
> nv_status = p_nvenc->nvEncSetIOCudaStreams(ctx->nvencoder, &ctx->cu_stream, &ctx->cu_stream);
> if (nv_status != NV_ENC_SUCCESS) {
> nvenc_pop_context(avctx);
>
This will need a lot more handling of error cases to present a
meaningful error.
More information about the ffmpeg-devel
mailing list