vaapidecodebin: delay the bin configuration
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Wed, 11 Nov 2015 15:33:24 +0000 (16:33 +0100)
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Mon, 16 Nov 2015 15:07:07 +0000 (16:07 +0100)
Delay the bin configuration until changing to READY state. This is because we
should add the vaapipostproc element until the vaapidecode has emitted the
HAVE_CONTEXT message, so de gst_bin_add() could set the context set to
vaapipostproc.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=757957

gst/vaapi/gstvaapidecodebin.c

index 4baec20..edde5c8 100644 (file)
@@ -194,10 +194,16 @@ ensure_vpp (GstVaapiDecodeBin * vaapidecbin)
 
   gst_vaapi_display_unref (display);
 
-  if (!activate_vpp (vaapidecbin))
+  return TRUE;
+}
+
+static gboolean
+gst_vaapi_decode_bin_reconfigure (GstVaapiDecodeBin* vaapidecbin)
+{
+  if (!ensure_vpp (vaapidecbin))
     return FALSE;
 
-  return TRUE;
+  return activate_vpp (vaapidecbin);
 }
 
 static void
@@ -311,8 +317,6 @@ gst_vaapi_decode_bin_handle_message (GstBin * bin, GstMessage * message)
     }
   }
 
-  activate_vpp (vaapidecbin);
-
 bail:
   if (display)
     gst_vaapi_display_unref (display);
@@ -343,7 +347,7 @@ gst_vaapi_decode_bin_change_state (GstElement * element,
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-      if (!ensure_vpp (vaapidecbin))
+      if (!gst_vaapi_decode_bin_reconfigure (vaapidecbin))
         return GST_STATE_CHANGE_FAILURE;
       break;
     default: