Remove skipped part of buffer when mapping the adapter

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=674085
This commit is contained in:
Matej Knopp 2012-04-14 03:27:29 +02:00 committed by Wim Taymans
parent fc8b28455f
commit 4e7cf4c5c1

View file

@ -361,11 +361,13 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, gsize size)
head = g->data;
g = g_slist_next (g);
/* How large do we want our head buffer? The requested size, plus whatever's
* been skipped already */
size += adapter->skip;
hsize = gst_buffer_get_size (head);
/* Remove skipped part from the buffer (otherwise the buffer might grow indefinitely) */
gst_buffer_resize (head, adapter->skip, hsize - adapter->skip);
hsize -= adapter->skip;
adapter->skip = 0;
while (g != NULL && hsize < size) {
cur = g->data;
/* Merge the head buffer and the next in line */