mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-20 02:50:16 +00:00
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:
parent
1cba2f3633
commit
e070d3ebed
1 changed files with 18 additions and 0 deletions
|
@ -81,8 +81,14 @@ plugin_add_dependencies (GstPlugin * plugin)
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
|
GstVaapiDisplay *display;
|
||||||
|
|
||||||
plugin_add_dependencies (plugin);
|
plugin_add_dependencies (plugin);
|
||||||
|
|
||||||
|
display = gst_vaapi_create_test_display ();
|
||||||
|
if (!display)
|
||||||
|
goto error_no_display;
|
||||||
|
|
||||||
gst_vaapidecode_register (plugin);
|
gst_vaapidecode_register (plugin);
|
||||||
|
|
||||||
gst_element_register (plugin, "vaapipostproc",
|
gst_element_register (plugin, "vaapipostproc",
|
||||||
|
@ -114,7 +120,19 @@ plugin_init (GstPlugin * plugin)
|
||||||
|
|
||||||
gst_element_register (plugin, "vaapidecodebin",
|
gst_element_register (plugin, "vaapidecodebin",
|
||||||
GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN);
|
GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN);
|
||||||
|
|
||||||
|
gst_vaapi_display_unref (display);
|
||||||
|
|
||||||
return TRUE;
|
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,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
|
||||||
|
|
Loading…
Reference in a new issue