glbasememory: Don't change maxsize at run-time
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 4 Mar 2016 00:45:43 +0000 (19:45 -0500)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:17 +0000 (19:32 +0000)
Maxsize is initialized once and should never change. Allocating data
should have no impact on the selected max size for this memory. This
causing memory map failure as the maxsize would become smaller then
size. This happened when using direct rendering in avviddec on GL that
does not support PBO transfer.

https://bugzilla.gnome.org/show_bug.cgi?id=763045

gst-libs/gst/gl/gstglbasememory.c

index 88cb881..7300da5 100644 (file)
@@ -171,7 +171,7 @@ gst_gl_base_memory_init (GstGLBaseMemory * mem, GstAllocator * allocator,
 }
 
 static gpointer
-_align_data (gpointer data, gsize align, gsize * maxsize)
+_align_data (gpointer data, gsize align)
 {
   guint8 *ret = data;
   gsize aoffset;
@@ -180,7 +180,6 @@ _align_data (gpointer data, gsize align, gsize * maxsize)
   if ((aoffset = ((guintptr) ret & align))) {
     aoffset = (align + 1) - aoffset;
     ret += aoffset;
-    *maxsize -= aoffset;
   }
 
   return ret;
@@ -202,7 +201,7 @@ gst_gl_base_memory_alloc_data (GstGLBaseMemory * gl_mem)
   if (gl_mem->alloc_data == NULL)
     return FALSE;
 
-  gl_mem->data = _align_data (gl_mem->alloc_data, mem->align, &mem->maxsize);
+  gl_mem->data = _align_data (gl_mem->alloc_data, mem->align);
 
   GST_CAT_DEBUG (GST_CAT_GL_BASE_MEMORY, "%p allocated data pointer alloc %p, "
       "data %p", gl_mem, gl_mem->alloc_data, gl_mem->data);