From 17560bf86ac1a6650962b867592e4337cf9130d0 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 12 Jan 2018 05:34:46 -0800 Subject: [PATCH] Revert "obs-ffmpeg: Improve NVENC detection" This reverts commit 94b5982216f253f4f4d355109a6dcb81f3a3b980. Reverting this commit because it had some negative side effects, such as adding 500 milliseconds to the startup time. NVENC detection should really be done through its proper API, and not via creating an encoder on startup. --- plugins/obs-ffmpeg/obs-ffmpeg.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c index 1109c06ca..30f30bd02 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg.c @@ -116,8 +116,6 @@ cleanup: destroy_log_context(log_context); } -static const char *nvenc_check_name = "nvenc_check"; - static bool nvenc_supported(void) { AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264"); @@ -135,35 +133,8 @@ static bool nvenc_supported(void) #else lib = os_dlopen("libnvidia-encode.so.1"); #endif - if (!lib) - return false; - os_dlclose(lib); - - bool success = false; - profile_start(nvenc_check_name); - - AVCodecContext *context = avcodec_alloc_context3(nvenc); - if (!context) - goto cleanup; - - context->bit_rate = 5000; - context->width = 640; - context->height = 480; - context->time_base = (AVRational) { 1, 25 }; - context->pix_fmt = AV_PIX_FMT_YUV420P; - - if (avcodec_open2(context, nvenc, NULL) < 0) - goto cleanup; - - success = true; - -cleanup: - if (context) - avcodec_free_context(&context); - - profile_end(nvenc_check_name); - return success; + return !!lib; } bool obs_module_load(void) -- GitLab