mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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.
This commit is contained in:
parent
7479b64a2a
commit
aa8b8b57d7
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue