From ccbeb1988144a090e468f1e0ded5f97569c94e8a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 11 Apr 2012 12:02:50 +0200 Subject: [PATCH] queue2: update current read position before waiting When we don't have enough bytes in the ringbuffer to satisfy the current request, first update the current read position before waiting. If we don't do that, the ringbuffer might appear full and the writer will never write more bytes to wake us up. --- plugins/elements/gstqueue2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index a861fb7ff3..f0dd2ec8bb 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -1304,15 +1304,11 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length, } if (read_length == 0) { - if (QUEUE_IS_USING_RING_BUFFER (queue) - && queue->current->max_reading_pos > rpos) { - /* protect cached data (data between offset and max_reading_pos) - * and update current level */ + if (QUEUE_IS_USING_RING_BUFFER (queue)) { GST_DEBUG_OBJECT (queue, - "protecting cached data [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT - "]", rpos, queue->current->max_reading_pos); - queue->current->max_reading_pos = rpos; - update_cur_level (queue, queue->current); + "update current position [%" G_GUINT64_FORMAT "-%" + G_GUINT64_FORMAT "]", rpos, queue->current->max_reading_pos); + update_cur_pos (queue, queue->current, rpos); } GST_DEBUG_OBJECT (queue, "waiting for add"); GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);