From: Mark Nauwelaerts Date: Thu, 27 May 2010 10:50:22 +0000 (+0200) Subject: adapter: fix _try_to_merge_up X-Git-Tag: RELEASE-0.10.30~153 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa8b8b57d78808b88229db115896cae69ef7ec3a;p=platform%2Fupstream%2Fgstreamer.git adapter: fix _try_to_merge_up That is, provide correct return value (as documented), and actually loop to consider more than the first 2 buffers. --- diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c index 748a812..860f88c 100644 --- a/libs/gst/base/gstadapter.c +++ b/libs/gst/base/gstadapter.c @@ -321,6 +321,7 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, guint size) { GstBuffer *cur, *head; GSList *g; + gboolean ret = FALSE; g = adapter->buflist; if (g == NULL) @@ -336,7 +337,7 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, guint size) while (g != NULL && GST_BUFFER_SIZE (head) < size) { cur = g->data; if (!gst_buffer_is_span_fast (head, cur)) - return TRUE; + return ret; /* Merge the head buffer and the next in line */ GST_LOG_OBJECT (adapter, @@ -344,14 +345,17 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, guint size) GST_BUFFER_SIZE (head), GST_BUFFER_SIZE (cur), size); head = gst_buffer_join (head, cur); + ret = TRUE; /* Delete the front list item, and store our new buffer in the 2nd list * item */ adapter->buflist = g_slist_delete_link (adapter->buflist, adapter->buflist); g->data = head; + + g = g_slist_next (g); } - return FALSE; + return ret; } /**