playbin2: Fix cdda:// playback
authorJan Schmidt <thaytan@noraisin.net>
Thu, 14 May 2009 20:37:22 +0000 (21:37 +0100)
committerJan Schmidt <thaytan@noraisin.net>
Thu, 14 May 2009 21:50:53 +0000 (22:50 +0100)
Don't send async-start when the playsink has already been configured
before changing state.

gst/playback/gstplaysink.c

index 3cea83915e01c3a18f819484ab40a4d52de7a3d0..cc90fae6894b63326e8bf836b30c4cc1940c892c 100644 (file)
@@ -123,6 +123,7 @@ struct _GstPlaySink
   GMutex *lock;
 
   gboolean async_pending;
+  gboolean need_async_start;
 
   GstPlayFlags flags;
 
@@ -243,6 +244,7 @@ gst_play_sink_init (GstPlaySink * playsink)
   playsink->flags = GST_PLAY_FLAG_SOFT_VOLUME;
 
   playsink->lock = g_mutex_new ();
+  playsink->need_async_start = TRUE;
 }
 
 static void
@@ -755,8 +757,12 @@ do_async_start (GstPlaySink * playsink)
 {
   GstMessage *message;
 
+  if (!playsink->need_async_start)
+    return;
+
   playsink->async_pending = TRUE;
 
+  GST_INFO_OBJECT (playsink, "Sending async_start message");
   message = gst_message_new_async_start (GST_OBJECT_CAST (playsink), FALSE);
   GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
       (playsink), message);
@@ -768,12 +774,15 @@ do_async_done (GstPlaySink * playsink)
   GstMessage *message;
 
   if (playsink->async_pending) {
+    GST_INFO_OBJECT (playsink, "Sending async_done message");
     message = gst_message_new_async_done (GST_OBJECT_CAST (playsink));
     GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
         (playsink), message);
 
     playsink->async_pending = FALSE;
   }
+
+  playsink->need_async_start = FALSE;
 }
 
 /* try to change the state of an element. This function returns the element when
@@ -2352,6 +2361,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
       break;
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
       /* FIXME Release audio device when we implement that */
+      playsink->need_async_start = TRUE;
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       /* remove sinks we added */