From 9d11b3e79ea41109ef65775d9e53d3e2db388984 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Tue, 18 May 2010 17:42:07 +0200 Subject: [PATCH] queue2: fix buffering percentage in ring buffer mode --- plugins/elements/gstqueue2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 957b6b8..9e46d1e 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -763,7 +763,15 @@ update_buffering (GstQueue2 * queue) percent = 100; } else { /* figure out the percent we are filled, we take the max of all formats. */ - percent = GET_PERCENT (bytes); + + if (!QUEUE_IS_USING_RING_BUFFER (queue)) { + percent = GET_PERCENT (bytes); + } else { + guint max_bytes = queue->max_level.bytes; + guint64 rb_size = queue->ring_buffer_max_size; + max_bytes = max_bytes ? MIN (max_bytes, rb_size) : rb_size; + percent = max_bytes ? queue->cur_level.bytes * 100 / max_bytes : 0; + } percent = MAX (percent, GET_PERCENT (time)); percent = MAX (percent, GET_PERCENT (buffers)); -- 2.7.4