autodetect: bring the element state down after success
authorMatthew Waters <matthew@centricular.com>
Fri, 11 Nov 2016 03:31:03 +0000 (14:31 +1100)
committerMatthew Waters <matthew@centricular.com>
Mon, 9 Jan 2017 14:20:18 +0000 (01:20 +1100)
Otherwise some messages that are emitted by the element on NULL->READY
will not reach the application.

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

gst/autodetect/gstautodetect.c

index a256e52..3e30241 100644 (file)
@@ -310,6 +310,7 @@ gst_auto_detect_find_best (GstAutoDetect * self)
       ret = gst_element_set_state (el, GST_STATE_READY);
       if (ret == GST_STATE_CHANGE_SUCCESS) {
         GST_DEBUG_OBJECT (self, "This worked!");
+        gst_element_set_state (el, GST_STATE_NULL);
         choice = el;
         break;
       }
@@ -379,14 +380,13 @@ gst_auto_detect_detect (GstAutoDetect * self)
   }
 
   self->kid = kid;
-  /* Ensure the child is brought up to the right state to match the parent.
-   * Although it's currently always in READY and we're always doing NULL->READY.
-   */
-  if (GST_STATE (self->kid) < GST_STATE (self))
-    gst_element_set_state (self->kid, GST_STATE (self));
 
   gst_bin_add (GST_BIN (self), kid);
 
+  /* Ensure the child is brought up to the right state to match the parent. */
+  if (GST_STATE (self->kid) < GST_STATE (self))
+    gst_element_set_state (self->kid, GST_STATE (self));
+
   /* attach ghost pad */
   GST_DEBUG_OBJECT (self, "Re-assigning ghostpad");
   if (!gst_auto_detect_attach_ghost_pad (self))