v4l2src: Ensure internal pool activation
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 8 Jul 2014 17:34:28 +0000 (13:34 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Wed, 9 Jul 2014 19:26:12 +0000 (15:26 -0400)
Before we would hit an assertion "'gst_buffer_pool_is_active (bpool)' failed"
if the internal pool was not used to push buffer downstrea, hence not
given to the baseclass.

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

sys/v4l2/gstv4l2src.c

index 1386333..e1c0df0 100644 (file)
@@ -464,7 +464,20 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
   if (gst_v4l2_object_decide_allocation (src->v4l2object, query))
     ret = GST_BASE_SRC_CLASS (parent_class)->decide_allocation (bsrc, query);
 
+  if (ret) {
+    if (!gst_buffer_pool_set_active (src->v4l2object->pool, TRUE))
+      goto activate_failed;
+  }
+
   return ret;
+
+activate_failed:
+  {
+    GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
+        (_("Failed to allocate required memory.")),
+        ("Buffer pool activation failed"));
+    return FALSE;
+  }
 }
 
 static gboolean