[rhythmbox] playbin: ensure tags don't persist into the next stream



commit f443369ed9be02335140567331b996e335f7c7fb
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Apr 28 22:20:51 2014 +1000

    playbin: ensure tags don't persist into the next stream
    
    During track changes, flush the bus to ensure that tag messages that
    haven't made it to our bus handler yet are discarded.  This was most
    noticeable when skipping tracks with embedded cover art, especially
    when the next track didn't have it, as sometimes the cover art from
    the previous track would be applied to the next.

 backends/gstreamer/rb-player-gst.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index ef6f9dd..5b611b2 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -441,6 +441,16 @@ state_change_finished (RBPlayerGst *mp, GError *error)
                if (error != NULL) {
                        g_warning ("unable to stop playback: %s\n", error->message);
                } else {
+                       GstBus *bus;
+
+                       /* flush bus to ensure tags from the previous stream don't
+                        * get applied to the new one
+                        */
+                       bus = gst_element_get_bus (mp->priv->playbin);
+                       gst_bus_set_flushing (bus, TRUE);
+                       gst_bus_set_flushing (bus, FALSE);
+                       gst_object_unref (bus);
+
                        rb_debug ("setting new playback URI %s", mp->priv->uri);
                        g_object_set (mp->priv->playbin, "uri", mp->priv->uri, NULL);
                        start_state_change (mp, GST_STATE_PLAYING, FINISH_TRACK_CHANGE);


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