rhythmbox r6223 - in trunk: . backends/gstreamer



Author: jmatthew
Date: Wed Mar 18 09:44:41 2009
New Revision: 6223
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6223&view=rev

Log:
2009-03-18  Jonathan Matthew  <jonathan d14n org>

	* backends/gstreamer/rb-player-gst-xfade.c:
	(link_and_unblock_stream), (unlink_blocked_cb),
	(unlink_and_block_stream), (rb_player_gst_xfade_bus_cb):
	Add a flag to detect repeated pad block callback invocations, rather
	than relying on the presence of a pad.  Sometimes we relink the stream
	in the pad block callback, so the next time through we'd unlink it
	again.  Fixes occasional crashes when playing audio CDs.


Modified:
   trunk/ChangeLog
   trunk/backends/gstreamer/rb-player-gst-xfade.c

Modified: trunk/backends/gstreamer/rb-player-gst-xfade.c
==============================================================================
--- trunk/backends/gstreamer/rb-player-gst-xfade.c	(original)
+++ trunk/backends/gstreamer/rb-player-gst-xfade.c	Wed Mar 18 09:44:41 2009
@@ -305,6 +305,7 @@
 	GstPad *ghost_pad;
 	GstPad *adder_pad;
 	gboolean src_blocked;
+	gboolean needs_unlink;
 	GstClockTime base_time;
 
 	gint64 seek_target;
@@ -1121,6 +1122,7 @@
 		rb_debug ("stream %s is already linked", stream->uri);
 		return TRUE;
 	}
+	stream->needs_unlink = FALSE;
 
 	rb_debug ("linking stream %s", stream->uri);
 	if (GST_ELEMENT_PARENT (stream->bin) == NULL)
@@ -1286,8 +1288,8 @@
 
 	g_mutex_lock (stream->lock);
 
-	if (stream->adder_pad == NULL) {
-		rb_debug ("stream %s is already unlinked.  huh?", stream->uri);
+	if (stream->needs_unlink == FALSE) {
+		rb_debug ("stream %s doesn't need to be unlinked", stream->uri);
 		g_mutex_unlock (stream->lock);
 		return;
 	}
@@ -1297,6 +1299,7 @@
 	if (gst_pad_unlink (stream->ghost_pad, stream->adder_pad) == FALSE) {
 		g_warning ("Couldn't unlink stream %s: things will probably go quite badly from here on", stream->uri);
 	}
+	stream->needs_unlink = FALSE;
 
 	gst_element_release_request_pad (GST_PAD_PARENT (stream->adder_pad), stream->adder_pad);
 	stream->adder_pad = NULL;
@@ -1345,7 +1348,11 @@
 {
 	if (stream->adder_pad == NULL) {
 		rb_debug ("stream %s is not linked", stream->uri);
-	} else if (stream->src_blocked) {
+		return;
+	}
+
+	stream->needs_unlink = TRUE;
+	if (stream->src_blocked) {
 		/* probably shouldn't happen, but we'll handle it anyway */
 		unlink_blocked_cb (stream->src_pad, TRUE, stream);
 	} else {
@@ -1746,6 +1753,7 @@
 			rb_debug ("got EOS message for stream %s -> PENDING_REMOVE", stream->uri);
 			_rb_player_emit_eos (RB_PLAYER (player), stream->stream_data);
 			stream->state = PENDING_REMOVE;
+			stream->needs_unlink = TRUE;
 
 			unlink_blocked_cb (stream->src_pad, TRUE, stream);
 		} else {



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