mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
aggregator: don't compare templ instance pointers
One can pass the PadTemplate from the element_class or the one from the factory. While they have the same content, the addresses are different.
This commit is contained in:
parent
0b9aea86f8
commit
c1fa51953c
1 changed files with 30 additions and 25 deletions
|
@ -1312,34 +1312,39 @@ gst_aggregator_default_create_new_pad (GstAggregator * self,
|
||||||
GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
|
GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstAggregatorPad *agg_pad;
|
GstAggregatorPad *agg_pad;
|
||||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (self);
|
|
||||||
GstAggregatorPrivate *priv = self->priv;
|
GstAggregatorPrivate *priv = self->priv;
|
||||||
|
gint serial = 0;
|
||||||
|
gchar *name = NULL;
|
||||||
|
|
||||||
if (templ == gst_element_class_get_pad_template (klass, "sink_%u")) {
|
if (templ->direction != GST_PAD_SINK ||
|
||||||
gint serial = 0;
|
g_strcmp0 (templ->name_template, "sink_%u"))
|
||||||
gchar *name = NULL;
|
goto not_sink;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (self);
|
GST_OBJECT_LOCK (self);
|
||||||
if (req_name == NULL || strlen (req_name) < 6
|
if (req_name == NULL || strlen (req_name) < 6
|
||||||
|| !g_str_has_prefix (req_name, "sink_")) {
|
|| !g_str_has_prefix (req_name, "sink_")) {
|
||||||
/* no name given when requesting the pad, use next available int */
|
/* no name given when requesting the pad, use next available int */
|
||||||
priv->padcount++;
|
priv->padcount++;
|
||||||
} else {
|
|
||||||
/* parse serial number from requested padname */
|
|
||||||
serial = g_ascii_strtoull (&req_name[5], NULL, 10);
|
|
||||||
if (serial >= priv->padcount)
|
|
||||||
priv->padcount = serial;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = g_strdup_printf ("sink_%u", priv->padcount);
|
|
||||||
agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
|
|
||||||
"name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
|
|
||||||
g_free (name);
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (self);
|
|
||||||
|
|
||||||
return agg_pad;
|
|
||||||
} else {
|
} else {
|
||||||
|
/* parse serial number from requested padname */
|
||||||
|
serial = g_ascii_strtoull (&req_name[5], NULL, 10);
|
||||||
|
if (serial >= priv->padcount)
|
||||||
|
priv->padcount = serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = g_strdup_printf ("sink_%u", priv->padcount);
|
||||||
|
agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
|
||||||
|
"name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
GST_OBJECT_UNLOCK (self);
|
||||||
|
|
||||||
|
return agg_pad;
|
||||||
|
|
||||||
|
/* errors */
|
||||||
|
not_sink:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (self, "request new pad that is not a SINK pad\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1868,7 +1873,7 @@ gst_aggregator_set_latency_property (GstAggregator * self, gint64 latency)
|
||||||
* Gets the latency value. See gst_aggregator_set_latency for
|
* Gets the latency value. See gst_aggregator_set_latency for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* Returns: The time in nanoseconds to wait for data to arrive on a sink pad
|
* Returns: The time in nanoseconds to wait for data to arrive on a sink pad
|
||||||
* before a pad is deemed unresponsive. A value of -1 means an
|
* before a pad is deemed unresponsive. A value of -1 means an
|
||||||
* unlimited time.
|
* unlimited time.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue