From: Wim Taymans Date: Fri, 23 Oct 2009 01:24:24 +0000 (-0400) Subject: multiqueue: make sure percent increases X-Git-Tag: RELEASE-0.10.26~288 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b852da60d496ca7d4f44ba26e5d71141d788d882;p=platform%2Fupstream%2Fgstreamer.git multiqueue: make sure percent increases Keep track of the last posted percent message and make sure the next percent messages are strictly increasing. --- diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 832a13d..70a99f9 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -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; } } diff --git a/plugins/elements/gstmultiqueue.h b/plugins/elements/gstmultiqueue.h index ef557ba..ec47601d 100644 --- a/plugins/elements/gstmultiqueue.h +++ b/plugins/elements/gstmultiqueue.h @@ -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 */