v4l2allocator: Don't dup imported DMABuf FD

There is no specific needs to duplicate the FD. Unlike the exportation,
we don't depend on code that will call close. This will make debugging
easyer since the traced FD will match the exporter.
This commit is contained in:
Nicolas Dufresne 2018-10-19 17:14:15 -04:00
parent abfc7da345
commit b25a01fab9

View File

@ -936,9 +936,6 @@ gst_v4l2_allocator_clear_dmabufin (GstV4l2Allocator * allocator,
GST_LOG_OBJECT (allocator, "[%i] clearing DMABUF import, fd %i plane %d", GST_LOG_OBJECT (allocator, "[%i] clearing DMABUF import, fd %i plane %d",
group->buffer.index, mem->dmafd, i); group->buffer.index, mem->dmafd, i);
if (mem->dmafd >= 0)
close (mem->dmafd);
/* Update memory */ /* Update memory */
mem->mem.maxsize = 0; mem->mem.maxsize = 0;
mem->mem.offset = 0; mem->mem.offset = 0;
@ -1078,8 +1075,7 @@ gst_v4l2_allocator_import_dmabuf (GstV4l2Allocator * allocator,
size = gst_memory_get_sizes (dma_mem[i], &offset, &maxsize); size = gst_memory_get_sizes (dma_mem[i], &offset, &maxsize);
if ((dmafd = dup (gst_dmabuf_memory_get_fd (dma_mem[i]))) < 0) dmafd = gst_dmabuf_memory_get_fd (dma_mem[i]);
goto dup_failed;
GST_LOG_OBJECT (allocator, "[%i] imported DMABUF as fd %i plane %d", GST_LOG_OBJECT (allocator, "[%i] imported DMABUF as fd %i plane %d",
group->buffer.index, dmafd, i); group->buffer.index, dmafd, i);
@ -1124,12 +1120,6 @@ not_dmabuf:
GST_ERROR_OBJECT (allocator, "Memory %i is not of DMABUF", i); GST_ERROR_OBJECT (allocator, "Memory %i is not of DMABUF", i);
return FALSE; return FALSE;
} }
dup_failed:
{
GST_ERROR_OBJECT (allocator, "Failed to dup DMABUF descriptor: %s",
g_strerror (errno));
return FALSE;
}
} }
gboolean gboolean