Commit f260baf2 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Sebastian Dröge

dmabuf: Ensure _get_fd() works even for shared memory

Fixes regression introduced by:

commit b60888fd
Author: Michael Olbrich <m.olbrich@pengutronix.de>
Date:   Tue May 20 11:18:56 2014 +0200

    dmabuf: share the mapping with shared copies of the memory

https://bugzilla.gnome.org/show_bug.cgi?id=730441
parent a84f1019
......@@ -69,7 +69,7 @@ gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * gmem)
g_warning (G_STRLOC ":%s: Freeing memory %p still mapped", G_STRFUNC, mem);
munmap ((void *) mem->data, gmem->maxsize);
}
if (mem->fd >= 0)
if (mem->fd >= 0 && gmem->parent == NULL)
close (mem->fd);
g_mutex_clear (&mem->lock);
g_slice_free (GstDmaBufMemory, mem);
......@@ -176,7 +176,7 @@ gst_dmabuf_mem_share (GstMemory * gmem, gssize offset, gssize size)
GST_MINI_OBJECT_FLAG_LOCK_READONLY, mem->mem.allocator, parent,
mem->mem.maxsize, mem->mem.align, mem->mem.offset + offset, size);
sub->fd = -1;
sub->fd = mem->fd;
g_mutex_init (&sub->lock);
return GST_MEMORY_CAST (sub);
......
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