decodebin2: Don't add non prerolled stream to topology
authorEdward Hervey <bilboed@bilboed.com>
Fri, 24 Sep 2010 14:02:42 +0000 (16:02 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Sun, 24 Oct 2010 14:18:17 +0000 (16:18 +0200)
If a final stream didn't preroll, don't add it to the topology since
it doesn't give any information at all.

https://bugzilla.gnome.org/show_bug.cgi?id=632988

gst/playback/gstdecodebin2.c

index f8c459f..3efeb31 100644 (file)
@@ -3000,6 +3000,12 @@ gst_decode_chain_get_topology (GstDecodeChain * chain)
   GList *l;
   GstCaps *caps;
 
+  if (G_UNLIKELY ((chain->endpad || chain->deadend)
+          && (chain->endcaps == NULL))) {
+    GST_WARNING ("End chain without valid caps !");
+    return NULL;
+  }
+
   u = gst_structure_id_empty_new (topology_structure_name);
 
   /* Now at the last element */
@@ -3021,10 +3027,12 @@ gst_decode_chain_get_topology (GstDecodeChain * chain)
     g_value_init (&item, GST_TYPE_STRUCTURE);
     for (l = chain->active_group->children; l; l = l->next) {
       s = gst_decode_chain_get_topology (l->data);
-      gst_value_set_structure (&item, s);
-      gst_value_list_append_value (&list, &item);
-      g_value_reset (&item);
-      gst_structure_free (s);
+      if (s) {
+        gst_value_set_structure (&item, s);
+        gst_value_list_append_value (&list, &item);
+        g_value_reset (&item);
+        gst_structure_free (s);
+      }
     }
     gst_structure_id_set_value (u, topology_next, &list);
     g_value_unset (&list);