diff --git a/sys/v4l2/gstv4l2allocator.c b/sys/v4l2/gstv4l2allocator.c index 5dcfd024f8..0281fc560f 100644 --- a/sys/v4l2/gstv4l2allocator.c +++ b/sys/v4l2/gstv4l2allocator.c @@ -852,7 +852,6 @@ gst_v4l2_allocator_alloc_dmabuf (GstV4l2Allocator * allocator, for (i = 0; i < group->n_mem; i++) { GstV4l2Memory *mem; GstMemory *dma_mem; - gint dmafd; if (group->mem[i] == NULL) { struct v4l2_exportbuffer expbuf = { 0 }; @@ -882,11 +881,8 @@ gst_v4l2_allocator_alloc_dmabuf (GstV4l2Allocator * allocator, g_assert (gst_is_v4l2_memory (group->mem[i])); mem = (GstV4l2Memory *) group->mem[i]; - if ((dmafd = dup (mem->dmafd)) < 0) - goto dup_failed; - - dma_mem = gst_dmabuf_allocator_alloc (dmabuf_allocator, dmafd, - group->planes[i].length); + dma_mem = gst_fd_allocator_alloc (dmabuf_allocator, mem->dmafd, + group->planes[i].length, GST_FD_MEMORY_FLAG_DONT_CLOSE); gst_memory_resize (dma_mem, group->planes[i].data_offset, group->planes[i].length - group->planes[i].data_offset); @@ -906,12 +902,6 @@ expbuf_failed: g_strerror (errno)); goto cleanup; } -dup_failed: - { - GST_ERROR_OBJECT (allocator, "Failed to dup DMABUF descriptor: %s", - g_strerror (errno)); - goto cleanup; - } cleanup: { _cleanup_failed_alloc (allocator, group);