From 52c419b7991bfc3d01c133c84e47aff0f2bc1545 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 5 May 2022 20:35:49 +0300 Subject: [PATCH] mpegtsmux: Disable aggregator's default negotiation 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: --- .../gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c b/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c index 894af5a..11c5acd 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c @@ -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; -- 2.7.4