From: Steinar H. Gunderson Date: Sun, 20 May 2018 10:45:14 +0000 (+0200) Subject: Make VA-API be less noisy when probing cards. X-Git-Tag: 1.7.3~1 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=07a53168e5388b89056a1e7aeb418740faa7ad4c;hp=ed3c94a505f84b168c24905d3817765a07a8d584 Make VA-API be less noisy when probing cards. --- 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; } }