[rhythmbox] xfade: work around GstPoll race



commit 403b3858ed89894c9c9929a5b20292b5578848a3
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Oct 17 20:09:09 2015 +1000

    xfade: work around GstPoll race
    
    This is a temporary hack that avoids hitting a race condition in GstPoll
    during sink startup, which manifests as the whole UI freezing while starting
    playback for the first time.
    
    With any luck, the GstPoll bug (https://bugzilla.gnome.org/show_bug.cgi?id=750397)
    will be fixed soon.

 backends/gstreamer/rb-player-gst-xfade.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index a30b9cb..f51f9d8 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -2919,6 +2919,17 @@ start_sink_locked (RBPlayerGstXFade *player, GList **messages, GError **error)
                GstState newstate;
                GstState pending;
 
+               /*
+                * when a second message is posted immediately after the first,
+                * this loop finishes processing the first at roughly the time the
+                * second is posted, so occasionally we'll hit this bug:
+                * https://bugzilla.gnome.org/show_bug.cgi?id=750397
+                * sleeping for 10us makes the read loop slow enough to avoid the
+                * race with state-changed and async-done messages, but hopefully
+                * not so much slower that we run into it in other conditions.
+                */
+               g_usleep (10);
+
                message = gst_bus_timed_pop (bus, GST_SECOND * 5);
                if (message == NULL) {
                        rb_debug ("sink is taking too long to start..");


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