dmabuf: Ensure _get_fd() works even for shared memory
Fixes regression introduced by: commit b60888fd4bcacd42bb4e27fa938272d6e72c5c32 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
This commit is contained in:
parent
a84f10196c
commit
f260baf23b
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user