playbin2: Return NOT_LINKED for unselected text pads from a demuxer
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 4 Nov 2009 09:52:06 +0000 (10:52 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 4 Nov 2009 09:53:27 +0000 (10:53 +0100)
We want to return NOT_LINKED for unselected pads but only for pads
from the normal uridecodebin. This makes sure that subtitle streams
are not raced past audio/video from decodebin2's multiqueue.

For pads from suburidecodebin OK should always be returned, otherwise
it will most likely stop with an error.

gst/playback/gstplaybin2.c

index 643c763..705cf3d 100644 (file)
@@ -2159,20 +2159,26 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
 
   if (changed) {
     int signal;
+    gboolean always_ok = (decodebin == group->suburidecodebin);
+
     switch (select->type) {
       case GST_PLAY_SINK_TYPE_VIDEO:
       case GST_PLAY_SINK_TYPE_VIDEO_RAW:
-        /* we want to return NOT_LINKED for unselected pads but only for audio
-         * and video pads because text pads might come from an external file. */
-        g_object_set (sinkpad, "always-ok", FALSE, NULL);
+        /* we want to return NOT_LINKED for unselected pads but only for pads
+         * from the normal uridecodebin. This makes sure that subtitle streams
+         * are not raced past audio/video from decodebin2's multiqueue.
+         * For pads from suburidecodebin OK should always be returned, otherwise
+         * it will most likely stop. */
+        g_object_set (sinkpad, "always-ok", always_ok, NULL);
         signal = SIGNAL_VIDEO_CHANGED;
         break;
       case GST_PLAY_SINK_TYPE_AUDIO:
       case GST_PLAY_SINK_TYPE_AUDIO_RAW:
-        g_object_set (sinkpad, "always-ok", FALSE, NULL);
+        g_object_set (sinkpad, "always-ok", always_ok, NULL);
         signal = SIGNAL_AUDIO_CHANGED;
         break;
       case GST_PLAY_SINK_TYPE_TEXT:
+        g_object_set (sinkpad, "always-ok", always_ok, NULL);
         signal = SIGNAL_TEXT_CHANGED;
         break;
       case GST_PLAY_SINK_TYPE_SUBPIC: