mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
xvimagsink: fix failure to allocate large shared memory blocks
A previous patch increased allocations by 15 bytes in order to ensure 16 byte alignment for g_malloc blocks. However, shared memory is already block aligned, and this extra 15 bytes caused allocation to fail when we were already allocating to the shared memory limit, which is a lot smaller than typical available RAM. Fix this by removing the alignment slack when allocating shared memory. https://bugzilla.gnome.org/show_bug.cgi?id=706066
This commit is contained in:
parent
3fd184da78
commit
964ea678da
1 changed files with 4 additions and 2 deletions
|
@ -346,7 +346,7 @@ gst_xvimage_allocator_alloc (GstXvImageAllocator * allocator, gint im_format,
|
||||||
int (*handler) (Display *, XErrorEvent *);
|
int (*handler) (Display *, XErrorEvent *);
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
GstXvContext *context;
|
GstXvContext *context;
|
||||||
gint align = 15, offset;
|
gint align, offset;
|
||||||
GstXvImageMemory *mem;
|
GstXvImageMemory *mem;
|
||||||
|
|
||||||
context = allocator->context;
|
context = allocator->context;
|
||||||
|
@ -453,8 +453,9 @@ gst_xvimage_allocator_alloc (GstXvImageAllocator * allocator, gint im_format,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get shared memory */
|
/* get shared memory */
|
||||||
|
align = 0;
|
||||||
mem->SHMInfo.shmid =
|
mem->SHMInfo.shmid =
|
||||||
shmget (IPC_PRIVATE, mem->xvimage->data_size + align, IPC_CREAT | 0777);
|
shmget (IPC_PRIVATE, mem->xvimage->data_size, IPC_CREAT | 0777);
|
||||||
if (mem->SHMInfo.shmid == -1)
|
if (mem->SHMInfo.shmid == -1)
|
||||||
goto shmget_failed;
|
goto shmget_failed;
|
||||||
|
|
||||||
|
@ -489,6 +490,7 @@ gst_xvimage_allocator_alloc (GstXvImageAllocator * allocator, gint im_format,
|
||||||
goto create_failed;
|
goto create_failed;
|
||||||
|
|
||||||
/* we have to use the returned data_size for our image size */
|
/* we have to use the returned data_size for our image size */
|
||||||
|
align = 15; /* g_malloc aligns to 8, we need 16 */
|
||||||
mem->xvimage->data = g_malloc (mem->xvimage->data_size + align);
|
mem->xvimage->data = g_malloc (mem->xvimage->data_size + align);
|
||||||
|
|
||||||
XSync (context->disp, FALSE);
|
XSync (context->disp, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue