GNOME Bugzilla – Bug 706069
UVC Allocated buffers wrapped in GstBuffer get orphaned by GstBuffer API
Last modified: 2013-08-19 08:13:29 UTC
Created attachment 251735 [details] [review] Fix for orphaned UVC driver allocated buffers in v4l2src... So, I was able to "fix" an issue with v4l2src UVC driver allocated buffers being replaced (orphaned) by the GstBuffer API (gst_buffer_resize() for example) with the patch below which "puts back" the UVC driver allocated buffers to the GstBuffers in which they were initially placed when allocated and wrapped in a GstMemory object. diff -rupN gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.c gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.c --- gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.c 2013-07-08 10:27:16.000000000 -0400 +++ gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.c 2013-08-14 17:21:42.801320440 -0400 @@ -678,6 +678,12 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2Buffer if (v4l2_ioctl (pool->video_fd, VIDIOC_QBUF, &meta->vbuffer) < 0) goto queue_failed; + /* Memory may have been replaced in GstBuffer so put it back using meta cookie */ + gst_buffer_replace_memory (buf, 0, + gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, + meta->mem, meta->vbuffer.length, 0, meta->vbuffer.length, NULL, + NULL)); + pool->buffers[index] = buf; pool->num_queued++;
*** This bug has been marked as a duplicate of bug 706083 ***
Created attachment 251956 [details] [review] Fix for orphaned UVC driver allocated buffers in v4l2src...