mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
memory: fix maxsize after align
when we align the data pointer, make sure to update the maxsize. Add some more debug
This commit is contained in:
parent
0addca0810
commit
592b5bec39
1 changed files with 8 additions and 3 deletions
|
@ -146,7 +146,9 @@ _default_mem_init (GstMemoryDefault * mem, GstMemoryFlags flags,
|
||||||
mem->user_data = user_data;
|
mem->user_data = user_data;
|
||||||
mem->notify = notify;
|
mem->notify = notify;
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_MEMORY, "new memory %p", mem);
|
GST_CAT_DEBUG (GST_CAT_MEMORY, "new memory %p, maxsize:%" G_GSIZE_FORMAT
|
||||||
|
" offset:%" G_GSIZE_FORMAT " size:%" G_GSIZE_FORMAT, mem, maxsize,
|
||||||
|
offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new memory block that manages the given memory */
|
/* create a new memory block that manages the given memory */
|
||||||
|
@ -189,8 +191,11 @@ _default_mem_new_block (GstMemoryFlags flags, gsize maxsize, gsize align,
|
||||||
|
|
||||||
data = (guint8 *) mem + sizeof (GstMemoryDefault);
|
data = (guint8 *) mem + sizeof (GstMemoryDefault);
|
||||||
|
|
||||||
if ((aoffset = ((guintptr) data & align)))
|
if ((aoffset = ((guintptr) data & align))) {
|
||||||
data += (align + 1) - aoffset;
|
aoffset = (align + 1) - aoffset;
|
||||||
|
data += aoffset;
|
||||||
|
maxsize -= aoffset;
|
||||||
|
}
|
||||||
|
|
||||||
if (offset && (flags & GST_MEMORY_FLAG_ZERO_PREFIXED))
|
if (offset && (flags & GST_MEMORY_FLAG_ZERO_PREFIXED))
|
||||||
memset (data, 0, offset);
|
memset (data, 0, offset);
|
||||||
|
|
Loading…
Reference in a new issue