[Bug 777399] v4l2allocator: memory referenced too late

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Jan 24 14:56:48 UTC 2017


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

--- Comment #8 from Jean-Christophe Trotin <jean-christophe.trotin at st.com> ---
(In reply to Nicolas Dufresne (stormer) from comment #6)
> Ok, might be a valid bug, but it's the wrong fix. You must have a ref when
> calling qbuf() in the allocator. If it's not the case, it means there is a
> bug somewhere else.

As indicated in my previous comment (and as shown in the log), I have a
reference when calling qbuf() in the allocator.

When there's no problem, the sequence is:
(1) In gst_v4l2_allocator_qbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 1
before calling v4l2_ioctl (allocator->video_fd, VIDIOC_QBUF, &group->buffer)

(2) In gst_v4l2_allocator_qbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 2 after
calling gst_memory_ref (group->mem[i])

[Thread switch to gst_v4l2_allocator_dqbuf]

(3) In gst_v4l2_allocator_dqbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 2 after
calling v4l2_ioctl (allocator->video_fd, VIDIOC_DQBUF, &buffer) 

(4) In gst_v4l2_allocator_dqbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 1 after
calling gst_memory_unref (group->mem[i])


When there's a problem, the sequence is:
(1) In gst_v4l2_allocator_qbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 1
before calling v4l2_ioctl (allocator->video_fd, VIDIOC_QBUF, &group->buffer)

[Thread switch to gst_v4l2_allocator_dqbuf]

(2) In gst_v4l2_allocator_dqbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 1 after
calling v4l2_ioctl (allocator->video_fd, VIDIOC_DQBUF, &buffer) 

(3) In gst_v4l2_allocator_dqbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) = 0 after
calling gst_memory_unref (group->mem[i]) => the memory is released

[Thread switch: back to gst_v4l2_allocator_qbuf]

(4) In gst_v4l2_allocator_qbuf()
GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (group->mem[i])) =>
unspecified behavior as the memory is released

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list