From 07a53168e5388b89056a1e7aeb418740faa7ad4c Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 20 May 2018 12:45:14 +0200 Subject: [PATCH] Make VA-API be less noisy when probing cards. --- quicksync_encoder.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quicksync_encoder.cpp b/quicksync_encoder.cpp index f664157..5200ce6 100644 --- a/quicksync_encoder.cpp +++ b/quicksync_encoder.cpp @@ -2133,9 +2133,20 @@ int64_t QuickSyncEncoder::global_delay() const { string QuickSyncEncoder::get_usable_va_display() { + // Reduce the amount of chatter while probing, + // unless the user has specified otherwise. + bool need_env_reset = false; + if (getenv("LIBVA_MESSAGING_LEVEL") == nullptr) { + setenv("LIBVA_MESSAGING_LEVEL", "0", true); + need_env_reset = true; + } + // First try the default (ie., whatever $DISPLAY is set to). unique_ptr va_dpy = try_open_va("", nullptr, nullptr); if (va_dpy != nullptr) { + if (need_env_reset) { + unsetenv("LIBVA_MESSAGING_LEVEL"); + } return ""; } @@ -2154,6 +2165,9 @@ string QuickSyncEncoder::get_usable_va_display() fprintf(stderr, "Autodetected %s as a suitable replacement; using it.\n", path.c_str()); globfree(&g); + if (need_env_reset) { + unsetenv("LIBVA_MESSAGING_LEVEL"); + } return path; } } -- 2.39.2