mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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.
This commit is contained in:
parent
b25a01fab9
commit
f2fa61b6c5
1 changed files with 2 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue