[rhythmbox] xfade: fix race causing repeated attempts to link streams (bug #664831)



commit a5940fde434f50323009119681a70c9d645fd21f
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jan 14 23:54:24 2012 +1000

    xfade: fix race causing repeated attempts to link streams (bug #664831)
    
    commit 38c658a introduced a window where we'd attempt to link a
    stream to the adder twice, which would cause a "Failed to link new
    stream into GStreamer pipeline" error on the second attempt.  Fix this
    by adding a flag to the stream to indicate we're trying to link it,
    protected by the stream list lock, so now we'll only try once.

 backends/gstreamer/rb-player-gst-xfade.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 4cf011e..a74ef2e 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -342,6 +342,7 @@ typedef struct
 	RBPlayerPlayType play_type;
 	gint64 crossfade;
 	gboolean fading;
+	gboolean starting_eos;
 
 	gulong adjust_probe_id;
 
@@ -1607,7 +1608,8 @@ start_waiting_eos_streams (RBPlayerGstXFade *player)
 	g_static_rec_mutex_lock (&player->priv->stream_list_lock);
 	for (l = player->priv->streams; l != NULL; l = l->next) {
 		RBXFadeStream *pstream = l->data;
-		if (pstream->state == WAITING_EOS) {
+		if (pstream->state == WAITING_EOS && pstream->starting_eos == FALSE) {
+			pstream->starting_eos = TRUE;
 			to_start = g_list_prepend (to_start, g_object_ref (pstream));
 		}
 	}
@@ -2328,6 +2330,7 @@ actually_start_stream (RBXFadeStream *stream, GError **error)
 			/* wait for current stream's EOS */
 			rb_debug ("existing playing stream found; waiting for its EOS -> WAITING_EOS");
 			stream->state = WAITING_EOS;
+			stream->starting_eos = FALSE;
 		} else {
 			rb_debug ("no playing stream found, so starting immediately");
 			ret = link_and_unblock_stream (stream, error);



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