From: Sebastian Dröge Date: Mon, 9 Jul 2012 13:37:28 +0000 (+0200) Subject: queue: Fix handling of min-threshold and serialized queries X-Git-Tag: RELEASE-0.11.93~141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af73f3fc02a6eb698da3933ea7bd607b2b157772;p=platform%2Fupstream%2Fgstreamer.git queue: Fix handling of min-threshold and serialized queries 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. This also makes sending of serialized events, like caps, happen faster and potentially improves negotiation performance. Fixes bug #679458. --- diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index e116aa2..52475f9 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -821,9 +821,19 @@ out_flushing: static gboolean gst_queue_is_empty (GstQueue * queue) { + GstMiniObject *head; + 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]; + if (!GST_IS_BUFFER (head) && !GST_IS_BUFFER_LIST (head)) + return FALSE; + /* It is possible that a max size is reached before all min thresholds are. * Therefore, only consider it empty if it is not filled. */ return ((queue->min_threshold.buffers > 0 &&