Description: Reduce CPU usage and stuttery playback
 For some reason bvw_update_tags gets called constantly even when none are
 changing. And each call seems to trigger a clutter scene graph update.
 So totem was spending 20-25% of its time in g_signal_emit and below updating
 the clutter scene graph and GTK widgets. With this fix, totem's CPU usage
 drops by about a fifth and playback is much smoother (although still not
 perfect).
 .
 This fixes the totem portion of LP: #1698282 and LP: #1698270, although
 both bugs also need work done in clutter before they can be declared fully
 resolved.
Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1698282
Forwarded: yes
Last-Update: 2017-08-21

diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index a8a5dbae..5808bd92 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -2063,12 +2063,15 @@ 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 (gst_tag_list_is_equal (result, bvw->priv->tagcache)) {
+    gst_tag_list_unref (result);
+    return;
+  }
+  GST_DEBUG ("Tags: %" GST_PTR_FORMAT, tag_list);
   if (bvw->priv->tagcache)
     gst_tag_list_unref (bvw->priv->tagcache);
   bvw->priv->tagcache = result;
-- 
2.11.0

