[FFmpeg-devel] [PATCH 2/3] nvenc: check runtime 9.1 function ptrs before use

wangbin wbsecg1 at gmail.com
Wed Jul 15 17:34:01 EEST 2020


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);
-- 
2.24.1 (Apple Git-126)



More information about the ffmpeg-devel mailing list