From 8bf4c1e1a84b1b3c1310cf539b8eba49286012a9 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 15 Feb 2011 14:42:58 +0100 Subject: [PATCH] queue2: don't read beyond the end of file upstream in pull mode ... which could lead to a premature eos being reported downstream, rather than a successful partial read which would result when performed directly on e.g. basesrc. --- plugins/elements/gstqueue2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 956f2b9..ab55cbb 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -2657,6 +2657,14 @@ gst_queue2_get_range (GstPad * pad, guint64 offset, guint length, goto out_unexpected; } + if (G_UNLIKELY (offset + length > queue->upstream_size)) { + gst_queue2_update_upstream_size (queue); + if (queue->upstream_size > 0 && offset + length >= queue->upstream_size) { + length = queue->upstream_size - offset; + GST_DEBUG_OBJECT (queue, "adjusting length downto %d", length); + } + } + /* FIXME - function will block when the range is not yet available */ ret = gst_queue2_create_read (queue, offset, length, buffer); GST_QUEUE2_MUTEX_UNLOCK (queue); -- 2.7.4