From b8455445c5a7e154d20d7c1634dcdb67c2ebc6e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 Aug 2019 19:55:59 +0300 Subject: [PATCH] aggregator: Ensure that the source pad is created as a GstAggregatorPad if no type is given in the pad template Otherwise we would create a GstPad and that causes invalid memory accesses later. --- libs/gst/base/gstaggregator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c index f0cc877..6ca9894 100644 --- a/libs/gst/base/gstaggregator.c +++ b/libs/gst/base/gstaggregator.c @@ -2441,6 +2441,7 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass) { GstPadTemplate *pad_template; GstAggregatorPrivate *priv; + GType pad_type; g_return_if_fail (klass->aggregate != NULL); @@ -2460,7 +2461,13 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass) self->priv->peer_latency_max = self->priv->sub_latency_max = 0; self->priv->has_peer_latency = FALSE; - self->srcpad = gst_pad_new_from_template (pad_template, "src"); + pad_type = + GST_PAD_TEMPLATE_GTYPE (pad_template) == + G_TYPE_NONE ? GST_TYPE_AGGREGATOR_PAD : + GST_PAD_TEMPLATE_GTYPE (pad_template); + self->srcpad = + g_object_new (pad_type, "name", "src", "direction", GST_PAD_SRC, + "template", pad_template, NULL); gst_aggregator_reset_flow_values (self); -- 2.7.4