videoaggregator: push the caps event as soon as we receive it
authorMatthew Waters <ystreet00@gmail.com>
Thu, 7 Aug 2014 09:54:36 +0000 (19:54 +1000)
committerMatthew Waters <ystreet00@gmail.com>
Mon, 11 Aug 2014 13:36:27 +0000 (23:36 +1000)
Along with the required mandatory dependent events.

Some elements need to perform an allocation query inside
::negotiated_caps().  Without the caps event being sent prior,
downstream elements will be unable to answer and will return
an error.

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

gst-libs/gst/base/gstaggregator.c
gst-libs/gst/video/gstvideoaggregator.c

index 9274600..0868d53 100644 (file)
@@ -277,19 +277,6 @@ _check_all_pads_with_data_or_eos (GstAggregator * self,
   return FALSE;
 }
 
-/**
- * gst_aggregator_set_src_caps:
- * @self: The #GstAggregator
- * @caps: The #GstCaps to set later on the src pad.
- *
- * Sets the caps to be used on the src pad.
- */
-void
-gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
-{
-  gst_caps_replace (&self->priv->srccaps, caps);
-}
-
 static void
 _reset_flow_values (GstAggregator * self)
 {
@@ -351,6 +338,20 @@ _push_mandatory_events (GstAggregator * self)
 }
 
 /**
+ * gst_aggregator_set_src_caps:
+ * @self: The #GstAggregator
+ * @caps: The #GstCaps to set later on the src pad.
+ *
+ * Sets the caps to be used on the src pad.
+ */
+void
+gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
+{
+  gst_caps_replace (&self->priv->srccaps, caps);
+  _push_mandatory_events (self);
+}
+
+/**
  * gst_aggregator_finish_buffer:
  * @self: The #GstAggregator
  * @buffer: the #GstBuffer to push.
index 02e485c..58bcb2e 100644 (file)
@@ -283,7 +283,6 @@ struct _GstVideoAggregatorPrivate
 
   /* current caps */
   GstCaps *current_caps;
-  gboolean send_caps;
 };
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstVideoAggregator, gst_videoaggregator,
@@ -502,7 +501,7 @@ gst_videoaggregator_src_setcaps (GstVideoAggregator * vagg, GstCaps * caps)
   if (vagg->priv->current_caps == NULL ||
       gst_caps_is_equal (caps, vagg->priv->current_caps) == FALSE) {
     gst_caps_replace (&vagg->priv->current_caps, caps);
-    vagg->priv->send_caps = TRUE;
+    gst_aggregator_set_src_caps (agg, caps);
   }
 
 done:
@@ -1188,11 +1187,6 @@ gst_videoaggregator_aggregate (GstAggregator * agg)
   if (gst_pad_check_reconfigure (agg->srcpad))
     gst_videoaggregator_update_src_caps (vagg);
 
-  if (vagg->priv->send_caps) {
-    gst_aggregator_set_src_caps (agg, vagg->priv->current_caps);
-    vagg->priv->send_caps = FALSE;
-  }
-
   GST_VIDEO_AGGREGATOR_LOCK (vagg);
 
   if (agg->segment.position == -1)
@@ -1652,7 +1646,6 @@ gst_videoaggregator_start (GstAggregator * agg)
   if (!GST_AGGREGATOR_CLASS (gst_videoaggregator_parent_class)->start (agg))
     return FALSE;
 
-  vagg->priv->send_caps = TRUE;
   gst_segment_init (&agg->segment, GST_FORMAT_TIME);
   gst_caps_replace (&vagg->priv->current_caps, NULL);