vaapi: instantiate a VA display when registering

This patch tries to instantiate a GstVaapiDisplay when registering the plugin
features, if it fails, no gstreamer-vaapi element is registering.

The purpose of this patch is to avoid a situation where the user has
gstreamer-vaapi installed but their VA-API setup is not functional, which may
lead to unexpected behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-07-12 19:56:02 +02:00
parent 1cba2f3633
commit e070d3ebed

View file

@ -81,8 +81,14 @@ plugin_add_dependencies (GstPlugin * plugin)
static gboolean
plugin_init (GstPlugin * plugin)
{
GstVaapiDisplay *display;
plugin_add_dependencies (plugin);
display = gst_vaapi_create_test_display ();
if (!display)
goto error_no_display;
gst_vaapidecode_register (plugin);
gst_element_register (plugin, "vaapipostproc",
@ -114,7 +120,19 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, "vaapidecodebin",
GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN);
gst_vaapi_display_unref (display);
return TRUE;
/* ERRORS: */
error_no_display:
{
GST_ERROR ("Cannot create a VA display");
/* Avoid blacklisting: failure to create a display could be a
* transient condition */
return TRUE;
}
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,