提交 17560bf8 编写于 作者: J jp9000

Revert "obs-ffmpeg: Improve NVENC detection"

This reverts commit 94b59822.

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.
上级 e7de41fc
...@@ -116,8 +116,6 @@ cleanup: ...@@ -116,8 +116,6 @@ cleanup:
destroy_log_context(log_context); destroy_log_context(log_context);
} }
static const char *nvenc_check_name = "nvenc_check";
static bool nvenc_supported(void) static bool nvenc_supported(void)
{ {
AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264"); AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264");
...@@ -135,35 +133,8 @@ static bool nvenc_supported(void) ...@@ -135,35 +133,8 @@ static bool nvenc_supported(void)
#else #else
lib = os_dlopen("libnvidia-encode.so.1"); lib = os_dlopen("libnvidia-encode.so.1");
#endif #endif
if (!lib)
return false;
os_dlclose(lib); os_dlclose(lib);
return !!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;
} }
bool obs_module_load(void) bool obs_module_load(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册