buffer: don't over-allocate internal GstMeta items

We would allocate space for two GstMeta structs even though
there is only one in the end (the one in GstMetaItem and in
GstFooMeta overlap).
This commit is contained in:
Tim-Philipp Müller 2018-04-25 18:28:00 +01:00
parent b00b1d5361
commit 0691278377

View file

@ -140,7 +140,10 @@ struct _GstMetaItem
GstMetaItem *next; GstMetaItem *next;
GstMeta meta; GstMeta meta;
}; };
#define ITEM_SIZE(info) ((info)->size + sizeof (GstMetaItem))
/* info->size will be sizeof(FooMeta) which contains a GstMeta at the beginning
* too, and then there is again a GstMeta in GstMetaItem, so subtract one. */
#define ITEM_SIZE(info) ((info)->size + sizeof (GstMetaItem) - sizeof (GstMeta))
#define GST_BUFFER_MEM_MAX 16 #define GST_BUFFER_MEM_MAX 16