mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
queue: embed GstQueueArray structure
This commit is contained in:
parent
14632db174
commit
22d78bad25
2 changed files with 17 additions and 16 deletions
|
@ -92,7 +92,7 @@ GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
|||
queue->cur_level.time, \
|
||||
queue->min_threshold.time, \
|
||||
queue->max_size.time, \
|
||||
queue->queue->length)
|
||||
queue->queue.length)
|
||||
|
||||
/* Queue signals and args */
|
||||
enum
|
||||
|
@ -417,7 +417,7 @@ gst_queue_init (GstQueue * queue)
|
|||
g_cond_init (&queue->item_add);
|
||||
g_cond_init (&queue->item_del);
|
||||
|
||||
queue->queue = gst_queue_array_new (DEFAULT_MAX_SIZE_BUFFERS * 3 / 2);
|
||||
gst_queue_array_init (&queue->queue, DEFAULT_MAX_SIZE_BUFFERS * 3 / 2);
|
||||
|
||||
queue->sinktime = GST_CLOCK_TIME_NONE;
|
||||
queue->srctime = GST_CLOCK_TIME_NONE;
|
||||
|
@ -440,12 +440,13 @@ gst_queue_finalize (GObject * object)
|
|||
|
||||
GST_DEBUG_OBJECT (queue, "finalizing queue");
|
||||
|
||||
while (!gst_queue_array_is_empty (queue->queue)) {
|
||||
data = gst_queue_array_pop_head (queue->queue);
|
||||
while (!gst_queue_array_is_empty (&queue->queue)) {
|
||||
data = gst_queue_array_pop_head (&queue->queue);
|
||||
/* FIXME: if it's a query, shouldn't we unref that too? */
|
||||
if (!GST_IS_QUERY (data))
|
||||
gst_mini_object_unref (data);
|
||||
}
|
||||
gst_queue_array_free (queue->queue);
|
||||
gst_queue_array_clear (&queue->queue);
|
||||
|
||||
g_mutex_clear (&queue->qlock);
|
||||
g_cond_clear (&queue->item_add);
|
||||
|
@ -555,8 +556,8 @@ gst_queue_locked_flush (GstQueue * queue)
|
|||
{
|
||||
GstMiniObject *data;
|
||||
|
||||
while (!gst_queue_array_is_empty (queue->queue)) {
|
||||
data = gst_queue_array_pop_head (queue->queue);
|
||||
while (!gst_queue_array_is_empty (&queue->queue)) {
|
||||
data = gst_queue_array_pop_head (&queue->queue);
|
||||
/* Then lose another reference because we are supposed to destroy that
|
||||
data when flushing */
|
||||
if (!GST_IS_QUERY (data))
|
||||
|
@ -589,7 +590,7 @@ gst_queue_locked_enqueue_buffer (GstQueue * queue, gpointer item)
|
|||
apply_buffer (queue, buffer, &queue->sink_segment, TRUE, TRUE);
|
||||
|
||||
if (item)
|
||||
gst_queue_array_push_tail (queue->queue, item);
|
||||
gst_queue_array_push_tail (&queue->queue, item);
|
||||
GST_QUEUE_SIGNAL_ADD (queue);
|
||||
}
|
||||
|
||||
|
@ -610,7 +611,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
|
|||
case GST_EVENT_SEGMENT:
|
||||
apply_segment (queue, event, &queue->sink_segment, TRUE);
|
||||
/* 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");
|
||||
apply_segment (queue, event, &queue->src_segment, FALSE);
|
||||
queue->newseg_applied_to_src = TRUE;
|
||||
|
@ -624,7 +625,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
|
|||
}
|
||||
|
||||
if (item)
|
||||
gst_queue_array_push_tail (queue->queue, item);
|
||||
gst_queue_array_push_tail (&queue->queue, item);
|
||||
GST_QUEUE_SIGNAL_ADD (queue);
|
||||
}
|
||||
|
||||
|
@ -634,7 +635,7 @@ gst_queue_locked_dequeue (GstQueue * queue)
|
|||
{
|
||||
GstMiniObject *item;
|
||||
|
||||
item = gst_queue_array_pop_head (queue->queue);
|
||||
item = gst_queue_array_pop_head (&queue->queue);
|
||||
if (item == NULL)
|
||||
goto no_item;
|
||||
|
||||
|
@ -791,9 +792,9 @@ gst_queue_handle_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
|
||||
GST_LOG_OBJECT (queue, "queuing query %p (%s)", query,
|
||||
GST_QUERY_TYPE_NAME (query));
|
||||
gst_queue_array_push_tail (queue->queue, query);
|
||||
gst_queue_array_push_tail (&queue->queue, query);
|
||||
GST_QUEUE_SIGNAL_ADD (queue);
|
||||
while (queue->queue->length != 0) {
|
||||
while (queue->queue.length != 0) {
|
||||
/* for as long as the queue has items, we know the query is
|
||||
* not handled yet */
|
||||
GST_QUEUE_WAIT_DEL_CHECK (queue, out_flushing);
|
||||
|
@ -821,14 +822,14 @@ gst_queue_is_empty (GstQueue * queue)
|
|||
{
|
||||
GstMiniObject *head;
|
||||
|
||||
if (queue->queue->length == 0)
|
||||
if (queue->queue.length == 0)
|
||||
return TRUE;
|
||||
|
||||
/* Only consider the queue empty if the minimum thresholds
|
||||
* are not reached and data is at the queue head. Otherwise
|
||||
* we would block forever on serialized queries.
|
||||
*/
|
||||
head = queue->queue->array[queue->queue->head];
|
||||
head = queue->queue.array[queue->queue.head];
|
||||
if (!GST_IS_BUFFER (head) && !GST_IS_BUFFER_LIST (head))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ struct _GstQueue {
|
|||
gboolean eos;
|
||||
|
||||
/* the queue of data we're keeping our grubby hands on */
|
||||
GstQueueArray *queue;
|
||||
GstQueueArray queue;
|
||||
|
||||
GstQueueSize
|
||||
cur_level, /* currently in the queue */
|
||||
|
|
Loading…
Reference in a new issue