autoconvert: Remove the initial-identity property from autoconvert
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 7 Dec 2011 12:46:43 +0000 (13:46 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 7 Dec 2011 12:50:19 +0000 (13:50 +0100)
Initially creating an identity element to forward serialized
events downstream before any caps are known is broken behaviour.

Serialized events should only be forwarded downstream if the
caps are already known, otherwise autopluggers and other elements
using pad-blocks will fail.

This behaviour also doesn't work anymore after basetransform
was fixed to queue serialized events until the caps are known
as a result of fixing bug #659571.

See bug #599469, #665205.

gst/autoconvert/gstautoconvert.c
gst/autoconvert/gstautoconvert.h

index 9ff7135..43a7cc9 100644 (file)
@@ -45,8 +45,6 @@
 GST_DEBUG_CATEGORY (autoconvert_debug);
 #define GST_CAT_DEFAULT (autoconvert_debug)
 
-#define DEFAULT_INITIAL_IDENTITY FALSE
-
 #define GST_AUTOCONVERT_LOCK(ac) GST_OBJECT_LOCK (ac)
 #define GST_AUTOCONVERT_UNLOCK(ac) GST_OBJECT_UNLOCK (ac)
 
@@ -83,8 +81,7 @@ enum
 enum
 {
   PROP_0,
-  PROP_FACTORIES,
-  PROP_INITIAL_IDENTITY
+  PROP_FACTORIES
 };
 
 static void gst_auto_convert_set_property (GObject * object,
@@ -199,14 +196,6 @@ gst_auto_convert_class_init (GstAutoConvertClass * klass)
           " elements), can only be set once",
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  g_object_class_install_property (gobject_class, PROP_INITIAL_IDENTITY,
-      g_param_spec_boolean ("initial-identity",
-          "Install identity initially",
-          "If true, then the identity element will be installed initially "
-          "and used for event passing until the first data buffer arrives ",
-          DEFAULT_INITIAL_IDENTITY,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_auto_convert_change_state);
 }
@@ -249,8 +238,6 @@ gst_auto_convert_init (GstAutoConvert * autoconvert,
   gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->srcpad);
 
   gst_segment_init (&autoconvert->sink_segment, GST_FORMAT_UNDEFINED);
-
-  autoconvert->initial_identity = DEFAULT_INITIAL_IDENTITY;
 }
 
 static void
@@ -303,11 +290,6 @@ gst_auto_convert_set_property (GObject * object,
             " have been set or auto-discovered");
       GST_AUTOCONVERT_UNLOCK (autoconvert);
       break;
-    case PROP_INITIAL_IDENTITY:
-      GST_AUTOCONVERT_LOCK (autoconvert);
-      autoconvert->initial_identity = g_value_get_boolean (value);
-      GST_AUTOCONVERT_UNLOCK (autoconvert);
-      break;
   }
 }
 
@@ -326,11 +308,6 @@ gst_auto_convert_get_property (GObject * object,
       g_value_set_pointer (value, &autoconvert->factories);
       GST_AUTOCONVERT_UNLOCK (autoconvert);
       break;
-    case PROP_INITIAL_IDENTITY:
-      GST_AUTOCONVERT_LOCK (autoconvert);
-      g_value_set_boolean (value, autoconvert->initial_identity);
-      GST_AUTOCONVERT_UNLOCK (autoconvert);
-      break;
   }
 }
 
@@ -478,37 +455,12 @@ gst_auto_convert_get_subelement (GstAutoConvert * autoconvert,
     gboolean query_only)
 {
   GstElement *element = NULL;
-  gboolean initial_identity;
 
   GST_AUTOCONVERT_LOCK (autoconvert);
   if (autoconvert->current_subelement)
     element = gst_object_ref (autoconvert->current_subelement);
-  initial_identity = autoconvert->initial_identity;
   GST_AUTOCONVERT_UNLOCK (autoconvert);
 
-  if (G_UNLIKELY (!query_only && element == NULL && initial_identity)) {
-    /* No current sub-element - create an identity and install it */
-    GstElementFactory *identity_feature;
-    GstElement *identity;
-
-    GST_INFO_OBJECT (autoconvert,
-        "No existing child element - instantiating identity");
-    /* if the identity feature doesn't exist - something is very wrong */
-    identity_feature =
-        GST_ELEMENT_FACTORY_CAST (gst_default_registry_find_feature ("identity",
-            GST_TYPE_ELEMENT_FACTORY));
-    identity =
-        gst_auto_convert_get_or_make_element_from_factory (autoconvert,
-        identity_feature);
-    if (identity
-        && gst_auto_convert_activate_element (autoconvert, identity, NULL)) {
-      GST_AUTOCONVERT_LOCK (autoconvert);
-      if (autoconvert->current_subelement)
-        element = gst_object_ref (autoconvert->current_subelement);
-      GST_AUTOCONVERT_UNLOCK (autoconvert);
-    }
-  }
-
   return element;
 }
 
@@ -1124,15 +1076,6 @@ gst_auto_convert_sink_event (GstPad * pad, GstEvent * event)
   }
 
   internal_srcpad = gst_auto_convert_get_internal_srcpad (autoconvert);
-  if (internal_srcpad == NULL) {
-    /* Query the subelement - triggers creation of an identity if necessary */
-    GstElement *subelement =
-        gst_auto_convert_get_subelement (autoconvert, FALSE);
-    if (subelement)
-      gst_object_unref (subelement);
-    internal_srcpad = gst_auto_convert_get_internal_srcpad (autoconvert);
-  }
-
   if (internal_srcpad) {
     ret = gst_pad_push_event (internal_srcpad, event);
     gst_object_unref (internal_srcpad);
index 612bcb1..b2f3abf 100644 (file)
@@ -56,8 +56,6 @@ struct _GstAutoConvert
   GList *cached_events;
   GstSegment sink_segment;
   gboolean drop_newseg;
-
-  gboolean initial_identity;
 };
 
 struct _GstAutoConvertClass