From 9bcb0ea58eb837bcf3f071fe4d26a40e093f6547 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 17 Apr 2012 12:54:45 +0200 Subject: [PATCH] adapter: ensure writable head buffer before skipping part of it --- libs/gst/base/gstadapter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c index ff8108078e..f8bc61398d 100644 --- a/libs/gst/base/gstadapter.c +++ b/libs/gst/base/gstadapter.c @@ -359,14 +359,17 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, gsize size) return FALSE; head = g->data; - g = g_slist_next (g); hsize = gst_buffer_get_size (head); /* Remove skipped part from the buffer (otherwise the buffer might grow indefinitely) */ + head = gst_buffer_make_writable (head); gst_buffer_resize (head, adapter->skip, hsize - adapter->skip); hsize -= adapter->skip; adapter->skip = 0; + g->data = head; + + g = g_slist_next (g); while (g != NULL && hsize < size) { cur = g->data;