[totem] backend: Warn when tag updates are sent with no changes



commit 2f2230b6da805b7aa31794c6b49929369865176a
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Aug 28 13:01:46 2017 +0200

    backend: Warn when tag updates are sent with no changes
    
    When tag updates are sent but no tags changed, we end up constantly
    changing bits of UI, and eating CPU for no actual change.
    
    Warn loudly when this happens so that culprits can be fixed.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=786561

 src/backend/bacon-video-widget.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index a8a5dba..d3de751 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -2063,15 +2063,20 @@ bvw_update_tags (BaconVideoWidget * bvw, GstTagList *tag_list, const gchar *type
   GstTagList **cache = NULL;
   GstTagList *result;
 
-  GST_DEBUG ("Tags: %" GST_PTR_FORMAT, tag_list);
-
   /* all tags (replace previous tags, title/artist/etc. might change
    * in the middle of a stream, e.g. with radio streams) */
   result = gst_tag_list_merge (bvw->priv->tagcache, tag_list,
                                    GST_TAG_MERGE_REPLACE);
-  if (bvw->priv->tagcache)
-    gst_tag_list_unref (bvw->priv->tagcache);
+  if (bvw->priv->tagcache &&
+      result &&
+      gst_tag_list_is_equal (result, bvw->priv->tagcache)) {
+    gst_tag_list_unref (result);
+    GST_WARNING ("Pipeline sent %s tags update with no changes", type);
+    return;
+  }
+  g_clear_pointer (&bvw->priv->tagcache, gst_tag_list_unref);
   bvw->priv->tagcache = result;
+  GST_DEBUG ("Tags: %" GST_PTR_FORMAT, tag_list);
 
   /* media-type-specific tags */
   if (!strcmp (type, "video")) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]