libs: utils: log warn if display fail
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 2 Oct 2017 16:53:21 +0000 (18:53 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 3 Oct 2017 11:37:23 +0000 (13:37 +0200)
gstreamer-vaapi initializes the display by trial-and-error, thus
logging an error message if the display initialisation fails the user
may be weary of the error message in the screen, if using VA-API 1.0

This commit set the VA error log handler to GStreamer warning level
while calling vaInitialize() and set it to error after that.

https://bugzilla.gnome.org/show_bug.cgi?id=783169

gst-libs/gst/vaapi/gstvaapiutils.c

index 5d7ae62..493cc09 100644 (file)
@@ -65,6 +65,18 @@ gst_vaapi_err (void *data, const char *message)
   GST_ERROR ("%s", msg);
   g_free (msg);
 }
+
+static void
+gst_vaapi_warning (void *data, const char *message)
+{
+  gchar *msg;
+
+  msg = strip_msg (message);
+  if (!msg)
+    return;
+  GST_WARNING ("%s", msg);
+  g_free (msg);
+}
 #endif
 
 static void
@@ -91,13 +103,18 @@ vaapi_initialize (VADisplay dpy)
   VAStatus status;
 
 #if VA_CHECK_VERSION (1,0,0)
-  vaSetErrorCallback (dpy, gst_vaapi_err, NULL);
+  vaSetErrorCallback (dpy, gst_vaapi_warning, NULL);
   vaSetInfoCallback (dpy, gst_vaapi_log, NULL);
 #elif VA_CHECK_VERSION (0,40,0)
   vaSetInfoCallback (gst_vaapi_log);
 #endif
 
   status = vaInitialize (dpy, &major_version, &minor_version);
+
+#if VA_CHECK_VERSION (1,0,0)
+  vaSetErrorCallback (dpy, gst_vaapi_err, NULL);
+#endif
+
   if (!vaapi_check_status (status, "vaInitialize()"))
     return FALSE;