multiqueue: make sure percent increases

Keep track of the last posted percent message and make sure the next percent
messages are strictly increasing.
This commit is contained in:
Wim Taymans 2009-10-22 21:24:24 -04:00 committed by Wim Taymans
parent 30fc865162
commit b852da60d4
2 changed files with 11 additions and 1 deletions

View file

@ -731,7 +731,6 @@ update_buffering (GstMultiQueue * mq, GstSingleQueue * sq)
tmp = (size.bytes * 100) / sq->max_size.bytes;
percent = MAX (percent, tmp);
}
percent = MIN (percent, 100);
}
if (mq->buffering) {
@ -739,9 +738,19 @@ update_buffering (GstMultiQueue * mq, GstSingleQueue * sq)
if (percent >= mq->high_percent) {
mq->buffering = FALSE;
}
/* make sure it increases */
percent = MAX (mq->percent, percent);
if (percent == mq->percent)
/* don't post if nothing changed */
post = FALSE;
else
/* else keep last value we posted */
mq->percent = percent;
} else {
if (percent < mq->low_percent) {
mq->buffering = TRUE;
mq->percent = percent;
post = TRUE;
}
}

View file

@ -61,6 +61,7 @@ struct _GstMultiQueue {
gboolean use_buffering;
gint low_percent, high_percent;
gboolean buffering;
gint percent;
guint32 counter; /* incoming object counter, protected with STREAM_LOCK */
guint32 highid; /* contains highest id of last outputted object */