[rhythmbox] xfade: block stream src pads while reusing streams after EOS (bug #631817)



commit 5f956137365e3780dc75b1ce4472e7868ee6c1f6
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Oct 20 17:41:18 2010 +1000

    xfade: block stream src pads while reusing streams after EOS (bug #631817)
    
    This only seems to happen when the track transition time is set to 0, and would
    trigger a not-linked error when the stream managed to push out a buffer before we
    could relink it.  Blocking the pad prevents this from occurring.

 backends/gstreamer/rb-player-gst-xfade.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 4d9f57b..3ac7b56 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -1264,6 +1264,16 @@ post_eos_seek_blocked_cb (GstPad *pad, gboolean blocked, RBXFadeStream *stream)
 	g_mutex_unlock (stream->lock);
 }
 
+/*
+ * called when a src pad for a stream is blocked during reuse.
+ * we don't need to do anything here.
+ */
+static void
+unlink_reuse_blocked_cb (GstPad *pad, gboolean blocked, RBXFadeStream *stream)
+{
+	rb_debug ("stream %s pad blocked during reuse", stream->uri);
+}
+
 static void
 unlink_reuse_relink (RBPlayerGstXFade *player, RBXFadeStream *stream)
 {
@@ -1292,6 +1302,15 @@ unlink_reuse_relink (RBPlayerGstXFade *player, RBXFadeStream *stream)
 
 	g_mutex_unlock (stream->lock);
 
+	/* block the src pad so we don't get not-linked errors if it pushes a buffer
+	 * before we get around to relinking
+	 */
+	gst_pad_set_blocked_async (stream->src_pad,
+				   TRUE,
+				   (GstPadBlockCallback) unlink_reuse_blocked_cb,
+				   stream);
+	stream->src_blocked = TRUE;
+
 	reuse_stream (stream);
 	if (link_and_unblock_stream (stream, &error) == FALSE) {
 		emit_stream_error (stream, error);



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