summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-08-31 13:05:57 +0100
committerTim-Philipp Müller <tim@centricular.com>2017-09-17 12:36:03 +0100
commitc2917b1ae2fc4956b7ef5a0ca49e32ebea899240 (patch)
treed80f793037fc06cda1bb06b36ba75f8564cf2358 /plugins
parent8f26af8b0251ea90f78c47732a6c3100a058ac51 (diff)
plugins: use new gst_buffer_list_calculate_size()
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gstqueue.c16
-rw-r--r--plugins/elements/gstqueue2.c20
2 files changed, 6 insertions, 30 deletions
diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c
index 00bc107ed..9c887c1c1 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -748,26 +748,14 @@ gst_queue_locked_enqueue_buffer (GstQueue * queue, gpointer item)
GST_QUEUE_SIGNAL_ADD (queue);
}
-static gboolean
-buffer_list_calc_size (GstBuffer ** buf, guint idx, gpointer data)
-{
- guint *p_size = data;
- gsize buf_size;
-
- buf_size = gst_buffer_get_size (*buf);
- GST_TRACE ("buffer %u in has size %" G_GSIZE_FORMAT, idx, buf_size);
- *p_size += buf_size;
- return TRUE;
-}
-
static inline void
gst_queue_locked_enqueue_buffer_list (GstQueue * queue, gpointer item)
{
GstQueueItem qitem;
GstBufferList *buffer_list = GST_BUFFER_LIST_CAST (item);
- gsize bsize = 0;
+ gsize bsize;
- gst_buffer_list_foreach (buffer_list, buffer_list_calc_size, &bsize);
+ bsize = gst_buffer_list_calculate_size (buffer_list);
/* add buffer to the statistics */
queue->cur_level.buffers += gst_buffer_list_length (buffer_list);
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 454b34bac..4fdf3489b 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -2173,18 +2173,6 @@ buffer_list_create_write (GstBuffer ** buf, guint idx, gpointer q)
return TRUE;
}
-static gboolean
-buffer_list_calc_size (GstBuffer ** buf, guint idx, gpointer data)
-{
- guint *p_size = data;
- gsize buf_size;
-
- buf_size = gst_buffer_get_size (*buf);
- GST_TRACE ("buffer %u in has size %" G_GSIZE_FORMAT, idx, buf_size);
- *p_size += buf_size;
- return TRUE;
-}
-
/* enqueue an item an update the level stats */
static void
gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item,
@@ -2215,11 +2203,11 @@ gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item,
}
} else if (item_type == GST_QUEUE2_ITEM_TYPE_BUFFER_LIST) {
GstBufferList *buffer_list;
- guint size = 0;
+ guint size;
buffer_list = GST_BUFFER_LIST_CAST (item);
- gst_buffer_list_foreach (buffer_list, buffer_list_calc_size, &size);
+ size = gst_buffer_list_calculate_size (buffer_list);
GST_LOG_OBJECT (queue, "total size of buffer list: %u bytes", size);
/* add buffer to the statistics */
@@ -2410,10 +2398,10 @@ gst_queue2_locked_dequeue (GstQueue2 * queue, GstQueue2ItemType * item_type)
}
} else if (GST_IS_BUFFER_LIST (item)) {
GstBufferList *buffer_list;
- guint size = 0;
+ guint size;
buffer_list = GST_BUFFER_LIST_CAST (item);
- gst_buffer_list_foreach (buffer_list, buffer_list_calc_size, &size);
+ size = gst_buffer_list_calculate_size (buffer_list);
*item_type = GST_QUEUE2_ITEM_TYPE_BUFFER_LIST;
GST_CAT_LOG_OBJECT (queue_dataflow, queue,