mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 11:32:51 +00:00
queue2: Don't report 0% unless empty
When preparing a buffering message, don't report 0% if there is any bytes left in the queue at all. We still have something to push, so don't tell the app to start buffering - maybe we'll get more data before actually running dry.
This commit is contained in:
parent
e5d5f99a9e
commit
725a71ea0c
1 changed files with 9 additions and 0 deletions
|
@ -875,6 +875,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);
|
||||
|
@ -888,6 +893,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
|
||||
|
||||
|
|
Loading…
Reference in a new issue