diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2013-07-29 15:48:32 +0200 |
---|---|---|
committer | Sjoerd Simons <sjoerd@luon.net> | 2013-07-31 09:50:47 +0200 |
commit | 0b068047354692442aa49bc418b398d2636facf3 (patch) | |
tree | 82e1ce073066b9046c3000b35846a6c01e7ce875 /plugins | |
parent | 280f55738018de2222d6cbfbce09051f91ae7c0d (diff) |
queue2: Fix backwards seeks into undowloaded ranges
When in download buffering mode queue2 didn't check if a range offset is
in a undownloaded range before the currently in-progress range. Causing
seeks to an earlier offset to, well, take a while.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/elements/gstqueue2.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 0af6fc1e9..a55e76a5d 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -1124,21 +1124,13 @@ gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length) guint64 threshold = 1024 * 512; if (QUEUE_IS_USING_RING_BUFFER (queue)) { - guint64 distance; - - distance = QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes; - /* don't wait for the complete buffer to fill */ - distance = MIN (distance, threshold); - - if (offset >= queue->current->offset && offset <= - queue->current->writing_pos + distance) { - GST_INFO_OBJECT (queue, - "requested data is within range, wait for data"); - return FALSE; - } - } else if (offset < queue->current->writing_pos + threshold) { - update_cur_pos (queue, queue->current, offset + length); - GST_INFO_OBJECT (queue, "wait for data"); + threshold = MIN (threshold, + QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes); + } + if (offset >= queue->current->offset && offset <= + queue->current->writing_pos + threshold) { + GST_INFO_OBJECT (queue, + "requested data is within range, wait for data"); return FALSE; } } |