queue2: only post buffering message when percent changed

This commit is contained in:
Wim Taymans 2010-09-15 13:29:52 +02:00
parent e3176a31e9
commit 2d1450d777

View file

@ -445,6 +445,8 @@ gst_queue2_init (GstQueue2 * queue, GstQueue2Class * g_class)
queue->item_del = g_cond_new (); queue->item_del = g_cond_new ();
queue->queue = g_queue_new (); queue->queue = g_queue_new ();
queue->buffering_percent = 100;
/* tempfile related */ /* tempfile related */
queue->temp_template = NULL; queue->temp_template = NULL;
queue->temp_location = NULL; queue->temp_location = NULL;
@ -824,6 +826,7 @@ update_buffering (GstQueue2 * queue)
if (percent > 100) if (percent > 100)
percent = 100; percent = 100;
if (percent != queue->buffering_percent) {
queue->buffering_percent = percent; queue->buffering_percent = percent;
if (!QUEUE_IS_USING_QUEUE (queue)) { if (!QUEUE_IS_USING_QUEUE (queue)) {
@ -854,7 +857,7 @@ update_buffering (GstQueue2 * queue)
queue->byte_in_rate, queue->byte_out_rate, buffering_left); queue->byte_in_rate, queue->byte_out_rate, buffering_left);
gst_element_post_message (GST_ELEMENT_CAST (queue), message); gst_element_post_message (GST_ELEMENT_CAST (queue), message);
}
} else { } else {
GST_DEBUG_OBJECT (queue, "filled %d percent", (gint) percent); GST_DEBUG_OBJECT (queue, "filled %d percent", (gint) percent);
} }