diff options
author | Jan Schmidt <jan@centricular.com> | 2015-11-06 03:02:42 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2015-11-07 00:55:17 +1100 |
commit | 00e04f392674e97597732b19a53666759c2b6a09 (patch) | |
tree | 04afee9e2fb5c857aba9b7c1bfd292706e12354c | |
parent | c316b20656ee29358bd8edd4d9f2f60eabe22d65 (diff) |
queue2: Don't report 0% unless emptySTREAMS_1_6_BACKPORTED
When preparing a buffering message, don't report 0% if there
is any bytes left in the queue at all.
-rw-r--r-- | plugins/elements/gstqueue2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 656066e61..009f17ec8 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -843,6 +843,11 @@ get_buffering_percent (GstQueue2 * queue, gboolean * is_buffering, perc = 100; GST_LOG_OBJECT (queue, "we are EOS"); } else { + GST_LOG_OBJECT (queue, + "Cur level bytes/time/buffers %u/%" GST_TIME_FORMAT "/%u", + queue->cur_level.bytes, GST_TIME_ARGS (queue->cur_level.time), + queue->cur_level.buffers); + /* figure out the percent we are filled, we take the max of all formats. */ if (!QUEUE_IS_USING_RING_BUFFER (queue)) { perc = GET_PERCENT (bytes, 0); @@ -856,6 +861,10 @@ get_buffering_percent (GstQueue2 * queue, gboolean * is_buffering, /* also apply the rate estimate when we need to */ if (queue->use_rate_estimate) perc = MAX (perc, GET_PERCENT (rate_time, 0)); + + /* Don't get to 0% unless we're really empty */ + if (queue->cur_level.bytes > 0) + perc = MAX (1, perc); } #undef GET_PERCENT |