Commit 2ee90e2b authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2: Keep ref to element in allocator/pool

Removes the FIXME/Question in the buffer pool and add a ref to the
element in the GstAllocator too. This ref is strictly required to keep
the GstV4l2Object structure around.
parent 33f508d5
......@@ -426,6 +426,7 @@ gst_v4l2_allocator_finalize (GObject * obj)
GST_LOG_OBJECT (obj, "called");
gst_atomic_queue_unref (allocator->free_queue);
gst_object_unref (allocator->obj->element);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
......@@ -648,6 +649,9 @@ gst_v4l2_allocator_new (GstObject * parent, GstV4l2Object * v4l2object)
/* Save everything */
allocator->obj = v4l2object;
/* Keep a ref on the elemnt so obj does not disapear */
gst_object_ref (allocator->obj->element);
flags |= GST_V4L2_ALLOCATOR_PROBE (allocator, MMAP);
flags |= GST_V4L2_ALLOCATOR_PROBE (allocator, USERPTR);
flags |= GST_V4L2_ALLOCATOR_PROBE (allocator, DMABUF);
......
......@@ -1521,8 +1521,7 @@ gst_v4l2_buffer_pool_finalize (GObject * object)
gst_poll_free (pool->poll);
/* FIXME Is this required to keep around ?
* This can't be done in dispose method because we must not set pointer
/* This can't be done in dispose method because we must not set pointer
* to NULL as it is part of the v4l2object and dispose could be called
* multiple times */
gst_object_unref (pool->obj->element);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment