vaapipostproc: Don't create filter on caps query
authorOlivier Crete <olivier.crete@collabora.com>
Wed, 15 Apr 2015 19:26:12 +0000 (15:26 -0400)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 16 Apr 2015 10:36:28 +0000 (12:36 +0200)
The problem with this is that creating the filter causes the display to
be selected, and the caps query happens while linking the element. So,
if the downstream or upstream element is using a specific display
object, it won't be propagated correctly to the postproc as it already
has a display at this point.

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

gst/vaapi/gstvaapipostproc.c

index e1ea5ac..2366338 100644 (file)
@@ -224,6 +224,9 @@ gst_vaapipostproc_ensure_filter (GstVaapiPostproc * postproc)
   if (!gst_vaapipostproc_ensure_display (postproc))
     return FALSE;
 
+  gst_caps_replace (&postproc->allowed_srcpad_caps, NULL);
+  gst_caps_replace (&postproc->allowed_sinkpad_caps, NULL);
+
   postproc->filter =
       gst_vaapi_filter_new (GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
   if (!postproc->filter)
@@ -297,7 +300,7 @@ gst_vaapipostproc_start (GstBaseTransform * trans)
   ds_reset (&postproc->deinterlace_state);
   if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (postproc)))
     return FALSE;
-  if (!gst_vaapipostproc_ensure_display (postproc))
+  if (!gst_vaapipostproc_ensure_filter (postproc))
     return FALSE;
   return TRUE;
 }
@@ -936,10 +939,8 @@ expand_allowed_srcpad_caps (GstVaapiPostproc * postproc, GstCaps * caps)
 {
   GValue value = G_VALUE_INIT, v_format = G_VALUE_INIT;
   guint i, num_structures;
-  gboolean had_filter;
 
-  had_filter = postproc->filter != NULL;
-  if (!had_filter && !gst_vaapipostproc_ensure_filter (postproc))
+  if (postproc->filter == NULL)
     goto cleanup;
   if (!gst_vaapipostproc_ensure_filter_caps (postproc))
     goto cleanup;
@@ -967,8 +968,6 @@ expand_allowed_srcpad_caps (GstVaapiPostproc * postproc, GstCaps * caps)
   g_value_unset (&value);
 
 cleanup:
-  if (!had_filter)
-    gst_vaapipostproc_destroy_filter (postproc);
   return caps;
 }