mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
queue: use statically allocated GQueue
This commit is contained in:
parent
d2c713a9b5
commit
2f8ac67726
2 changed files with 15 additions and 15 deletions
|
@ -91,7 +91,7 @@ GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
||||||
queue->cur_level.time, \
|
queue->cur_level.time, \
|
||||||
queue->min_threshold.time, \
|
queue->min_threshold.time, \
|
||||||
queue->max_size.time, \
|
queue->max_size.time, \
|
||||||
queue->queue->length)
|
queue->queue.length)
|
||||||
|
|
||||||
/* Queue signals and args */
|
/* Queue signals and args */
|
||||||
enum
|
enum
|
||||||
|
@ -430,7 +430,8 @@ gst_queue_init (GstQueue * queue, GstQueueClass * g_class)
|
||||||
queue->qlock = g_mutex_new ();
|
queue->qlock = g_mutex_new ();
|
||||||
queue->item_add = g_cond_new ();
|
queue->item_add = g_cond_new ();
|
||||||
queue->item_del = g_cond_new ();
|
queue->item_del = g_cond_new ();
|
||||||
queue->queue = g_queue_new ();
|
|
||||||
|
g_queue_init (&queue->queue);
|
||||||
|
|
||||||
queue->sinktime = GST_CLOCK_TIME_NONE;
|
queue->sinktime = GST_CLOCK_TIME_NONE;
|
||||||
queue->srctime = GST_CLOCK_TIME_NONE;
|
queue->srctime = GST_CLOCK_TIME_NONE;
|
||||||
|
@ -448,16 +449,15 @@ gst_queue_init (GstQueue * queue, GstQueueClass * g_class)
|
||||||
static void
|
static void
|
||||||
gst_queue_finalize (GObject * object)
|
gst_queue_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
GstMiniObject *data;
|
||||||
GstQueue *queue = GST_QUEUE (object);
|
GstQueue *queue = GST_QUEUE (object);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (queue, "finalizing queue");
|
GST_DEBUG_OBJECT (queue, "finalizing queue");
|
||||||
|
|
||||||
while (!g_queue_is_empty (queue->queue)) {
|
while ((data = g_queue_pop_head (&queue->queue)))
|
||||||
GstMiniObject *data = g_queue_pop_head (queue->queue);
|
|
||||||
|
|
||||||
gst_mini_object_unref (data);
|
gst_mini_object_unref (data);
|
||||||
}
|
|
||||||
g_queue_free (queue->queue);
|
g_queue_clear (&queue->queue);
|
||||||
g_mutex_free (queue->qlock);
|
g_mutex_free (queue->qlock);
|
||||||
g_cond_free (queue->item_add);
|
g_cond_free (queue->item_add);
|
||||||
g_cond_free (queue->item_del);
|
g_cond_free (queue->item_del);
|
||||||
|
@ -668,9 +668,9 @@ apply_buffer (GstQueue * queue, GstBuffer * buffer, GstSegment * segment,
|
||||||
static void
|
static void
|
||||||
gst_queue_locked_flush (GstQueue * queue)
|
gst_queue_locked_flush (GstQueue * queue)
|
||||||
{
|
{
|
||||||
while (!g_queue_is_empty (queue->queue)) {
|
GstMiniObject *data;
|
||||||
GstMiniObject *data = g_queue_pop_head (queue->queue);
|
|
||||||
|
|
||||||
|
while ((data = g_queue_pop_head (&queue->queue))) {
|
||||||
/* Then lose another reference because we are supposed to destroy that
|
/* Then lose another reference because we are supposed to destroy that
|
||||||
data when flushing */
|
data when flushing */
|
||||||
gst_mini_object_unref (data);
|
gst_mini_object_unref (data);
|
||||||
|
@ -701,7 +701,7 @@ gst_queue_locked_enqueue_buffer (GstQueue * queue, gpointer item)
|
||||||
queue->cur_level.bytes += GST_BUFFER_SIZE (buffer);
|
queue->cur_level.bytes += GST_BUFFER_SIZE (buffer);
|
||||||
apply_buffer (queue, buffer, &queue->sink_segment, TRUE, TRUE);
|
apply_buffer (queue, buffer, &queue->sink_segment, TRUE, TRUE);
|
||||||
|
|
||||||
g_queue_push_tail (queue->queue, item);
|
g_queue_push_tail (&queue->queue, item);
|
||||||
GST_QUEUE_SIGNAL_ADD (queue);
|
GST_QUEUE_SIGNAL_ADD (queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_NEWSEGMENT:
|
||||||
apply_segment (queue, event, &queue->sink_segment, TRUE);
|
apply_segment (queue, event, &queue->sink_segment, TRUE);
|
||||||
/* if the queue is empty, apply sink segment on the source */
|
/* if the queue is empty, apply sink segment on the source */
|
||||||
if (queue->queue->length == 0) {
|
if (queue->queue.length == 0) {
|
||||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "Apply segment on srcpad");
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "Apply segment on srcpad");
|
||||||
apply_segment (queue, event, &queue->src_segment, FALSE);
|
apply_segment (queue, event, &queue->src_segment, FALSE);
|
||||||
queue->newseg_applied_to_src = TRUE;
|
queue->newseg_applied_to_src = TRUE;
|
||||||
|
@ -735,7 +735,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_queue_push_tail (queue->queue, item);
|
g_queue_push_tail (&queue->queue, item);
|
||||||
GST_QUEUE_SIGNAL_ADD (queue);
|
GST_QUEUE_SIGNAL_ADD (queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ gst_queue_locked_dequeue (GstQueue * queue, gboolean * is_buffer)
|
||||||
{
|
{
|
||||||
GstMiniObject *item;
|
GstMiniObject *item;
|
||||||
|
|
||||||
item = g_queue_pop_head (queue->queue);
|
item = g_queue_pop_head (&queue->queue);
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
goto no_item;
|
goto no_item;
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ out_eos:
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_queue_is_empty (GstQueue * queue)
|
gst_queue_is_empty (GstQueue * queue)
|
||||||
{
|
{
|
||||||
if (queue->queue->length == 0)
|
if (queue->queue.length == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* It is possible that a max size is reached before all min thresholds are.
|
/* It is possible that a max size is reached before all min thresholds are.
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct _GstQueue {
|
||||||
gboolean eos;
|
gboolean eos;
|
||||||
|
|
||||||
/* the queue of data we're keeping our grubby hands on */
|
/* the queue of data we're keeping our grubby hands on */
|
||||||
GQueue *queue;
|
GQueue queue;
|
||||||
|
|
||||||
GstQueueSize
|
GstQueueSize
|
||||||
cur_level, /* currently in the queue */
|
cur_level, /* currently in the queue */
|
||||||
|
|
Loading…
Reference in a new issue