playbin2: fix linking order
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Mar 2009 14:27:27 +0000 (15:27 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Mar 2009 14:27:27 +0000 (15:27 +0100)
Link after doing the state change and unlink before shutting down. Makes the
window for causing races in toggling the visualisations smaller.
See #576187.

gst/playback/gstplaysink.c

index 848a914e4da6572fe416fca85e932c1045f589df..3fbf5663312cfed00743dbe09c1f11f7d9592c32 100644 (file)
@@ -1444,6 +1444,17 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
     GST_DEBUG_OBJECT (playsink, "no video needed");
     if (playsink->videochain) {
       GST_DEBUG_OBJECT (playsink, "removing video chain");
+      if (playsink->vischain) {
+        GstPad *srcpad;
+
+        GST_DEBUG_OBJECT (playsink, "unlinking vis chain");
+
+        /* also had visualisation, unlink the video from it first */
+        srcpad =
+            gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain->
+                chain.bin), "src");
+        gst_pad_unlink (srcpad, playsink->videochain->sinkpad);
+      }
       add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
       activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
     }
@@ -1549,18 +1560,19 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
     if (playsink->vischain) {
       GST_DEBUG_OBJECT (playsink, "setting up vis chain");
       srcpad =
-          gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->
-              vischain->chain.bin), "src");
+          gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain->
+              chain.bin), "src");
       add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
+      activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
       gst_pad_link (playsink->audio_tee_vissrc, playsink->vischain->sinkpad);
       gst_pad_link (srcpad, playsink->videochain->sinkpad);
       gst_object_unref (srcpad);
-      activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
     }
   } else {
     GST_DEBUG_OBJECT (playsink, "no vis needed");
     if (playsink->vischain) {
       GST_DEBUG_OBJECT (playsink, "removing vis chain");
+      gst_pad_unlink (playsink->audio_tee_vissrc, playsink->vischain->sinkpad);
       add_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
       activate_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
     }