mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
dmabuf: fix memory initialization
Without this the shared memory is broken https://bugzilla.gnome.org/show_bug.cgi?id=699565
This commit is contained in:
parent
72e32060b8
commit
a4ba85b151
1 changed files with 5 additions and 5 deletions
|
@ -153,12 +153,15 @@ gst_dmabuf_mem_share (GstMemory * gmem, gssize offset, gssize size)
|
||||||
if (size == -1)
|
if (size == -1)
|
||||||
size = mem->mem.size - offset;
|
size = mem->mem.size - offset;
|
||||||
|
|
||||||
sub = g_slice_new (GstDmaBufMemory);
|
sub = g_slice_new0 (GstDmaBufMemory);
|
||||||
/* the shared memory is always readonly */
|
/* the shared memory is always readonly */
|
||||||
gst_memory_init (GST_MEMORY_CAST (sub), GST_MINI_OBJECT_FLAGS (parent) |
|
gst_memory_init (GST_MEMORY_CAST (sub), GST_MINI_OBJECT_FLAGS (parent) |
|
||||||
GST_MINI_OBJECT_FLAG_LOCK_READONLY, mem->mem.allocator, parent,
|
GST_MINI_OBJECT_FLAG_LOCK_READONLY, mem->mem.allocator, parent,
|
||||||
mem->mem.maxsize, mem->mem.align, mem->mem.offset + offset, size);
|
mem->mem.maxsize, mem->mem.align, mem->mem.offset + offset, size);
|
||||||
|
|
||||||
|
sub->fd = dup (mem->fd);
|
||||||
|
g_mutex_init (&sub->lock);
|
||||||
|
|
||||||
return GST_MEMORY_CAST (sub);
|
return GST_MEMORY_CAST (sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,14 +271,11 @@ gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size)
|
||||||
|
|
||||||
GST_DEBUG ("alloc from allocator %p", allocator);
|
GST_DEBUG ("alloc from allocator %p", allocator);
|
||||||
|
|
||||||
mem = g_slice_new (GstDmaBufMemory);
|
mem = g_slice_new0 (GstDmaBufMemory);
|
||||||
|
|
||||||
gst_memory_init (GST_MEMORY_CAST (mem), 0, allocator, NULL, size, 0, 0, 0);
|
gst_memory_init (GST_MEMORY_CAST (mem), 0, allocator, NULL, size, 0, 0, 0);
|
||||||
|
|
||||||
mem->fd = fd;
|
mem->fd = fd;
|
||||||
mem->data = NULL;
|
|
||||||
mem->mmapping_flags = 0;
|
|
||||||
mem->mmap_count = 0;
|
|
||||||
g_mutex_init (&mem->lock);
|
g_mutex_init (&mem->lock);
|
||||||
|
|
||||||
GST_DEBUG ("%p: fd: %d size %" G_GSIZE_FORMAT, mem, mem->fd,
|
GST_DEBUG ("%p: fd: %d size %" G_GSIZE_FORMAT, mem, mem->fd,
|
||||||
|
|
Loading…
Reference in a new issue