Commit f2fa61b6 authored by Nicolas Dufresne's avatar Nicolas Dufresne

vl42allocator: Don't dup exported dmabufs

We can now use the new GstFAllocator to ask the allocator not to close
the wrapped FD. This way the dup is no longer needed.
parent b25a01fa
......@@ -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);
......
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