mpegtsmux: Disable aggregator's default negotiation
authorSebastian Dröge <sebastian@centricular.com>
Thu, 5 May 2022 17:35:49 +0000 (20:35 +0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 5 May 2022 17:41:58 +0000 (17:41 +0000)
mpegtsmux can't negotiate caps with upstream/downstream and always outputs
specific caps based on the input streams. This will always happen before
it produces the first buffers.

By having the default aggregator negotiation enabled the same caps
would be pushed twice in the beginning, and again every time a
reconfigure event is received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2372>

subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c

index 894af5a..11c5acd 100644 (file)
@@ -263,15 +263,14 @@ gst_base_ts_mux_set_header_on_caps (GstBaseTsMux * mux)
   GValue value = { 0 };
   GstCaps *caps;
 
-  caps = gst_pad_get_current_caps (GST_AGGREGATOR_SRC_PAD (mux));
-
-  /* If we have no caps, we are possibly shutting down */
-  if (!caps)
-    return;
+  caps = gst_pad_get_pad_template_caps (GST_AGGREGATOR_SRC_PAD (mux));
 
   caps = gst_caps_make_writable (caps);
   structure = gst_caps_get_structure (caps, 0);
 
+  gst_structure_set (structure, "packetsize", G_TYPE_INT, mux->packet_size,
+      NULL);
+
   g_value_init (&array, GST_TYPE_ARRAY);
 
   GST_LOG_OBJECT (mux, "setting %u packets into streamheader",
@@ -2249,20 +2248,6 @@ beach:
   return ret;
 }
 
-static GstFlowReturn
-gst_base_ts_mux_update_src_caps (GstAggregator * agg, GstCaps * caps,
-    GstCaps ** ret)
-{
-  GstBaseTsMux *mux = GST_BASE_TS_MUX (agg);
-  GstStructure *s;
-
-  *ret = gst_caps_copy (caps);
-  s = gst_caps_get_structure (*ret, 0);
-  gst_structure_set (s, "packetsize", G_TYPE_INT, mux->packet_size, NULL);
-
-  return GST_FLOW_OK;
-}
-
 static GstBaseTsMuxPad *
 gst_base_ts_mux_find_best_pad (GstAggregator * aggregator)
 {
@@ -2629,7 +2614,7 @@ gst_base_ts_mux_class_init (GstBaseTsMuxClass * klass)
   gstelement_class->release_pad = gst_base_ts_mux_release_pad;
   gstelement_class->send_event = gst_base_ts_mux_send_event;
 
-  gstagg_class->update_src_caps = gst_base_ts_mux_update_src_caps;
+  gstagg_class->negotiate = NULL;
   gstagg_class->aggregate = gst_base_ts_mux_aggregate;
   gstagg_class->clip = gst_base_ts_mux_clip;
   gstagg_class->sink_event = gst_base_ts_mux_sink_event;