mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
Fix pad template memleaks
Pad templates returned by gst_static_pad_template_get() were not being unreffed.
This commit is contained in:
parent
4eee2dc95d
commit
159e2768d6
5 changed files with 15 additions and 28 deletions
|
@ -140,14 +140,13 @@ gst_diracdec_init (GstDiracDec * diracdec)
|
||||||
/* create the sink and src pads */
|
/* create the sink and src pads */
|
||||||
|
|
||||||
diracdec->sinkpad =
|
diracdec->sinkpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_static_template (&gst_diracdec_sink_pad_template,
|
||||||
(&gst_diracdec_sink_pad_template), "sink");
|
"sink");
|
||||||
gst_pad_set_chain_function (diracdec->sinkpad, gst_diracdec_chain);
|
gst_pad_set_chain_function (diracdec->sinkpad, gst_diracdec_chain);
|
||||||
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->sinkpad);
|
||||||
|
|
||||||
diracdec->srcpad =
|
diracdec->srcpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_static_template (&gst_diracdec_src_pad_template, "src");
|
||||||
(&gst_diracdec_src_pad_template), "src");
|
|
||||||
gst_pad_use_explicit_caps (diracdec->srcpad);
|
gst_pad_use_explicit_caps (diracdec->srcpad);
|
||||||
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->srcpad);
|
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->srcpad);
|
||||||
|
|
||||||
|
@ -258,16 +257,15 @@ gst_diracdec_chain (GstPad * pad, GstData * _data)
|
||||||
diracdec->decoder->seq_params.width,
|
diracdec->decoder->seq_params.width,
|
||||||
diracdec->decoder->seq_params.height,
|
diracdec->decoder->seq_params.height,
|
||||||
(gdouble) fps_num / (gdouble) fps_denom,
|
(gdouble) fps_num / (gdouble) fps_denom,
|
||||||
gst_diracdec_chroma_to_fourcc (diracdec->decoder->
|
gst_diracdec_chroma_to_fourcc (diracdec->decoder->seq_params.
|
||||||
seq_params.chroma))) {
|
chroma))) {
|
||||||
GST_ELEMENT_ERROR (diracdec, CORE, NEGOTIATION, (NULL),
|
GST_ELEMENT_ERROR (diracdec, CORE, NEGOTIATION, (NULL),
|
||||||
("Failed to set caps to %dx%d @ %d fps (format=" GST_FOURCC_FORMAT
|
("Failed to set caps to %dx%d @ %d fps (format=" GST_FOURCC_FORMAT
|
||||||
"/%d)", diracdec->decoder->seq_params.width,
|
"/%d)", diracdec->decoder->seq_params.width,
|
||||||
diracdec->decoder->seq_params.height,
|
diracdec->decoder->seq_params.height,
|
||||||
diracdec->decoder->seq_params.frame_rate,
|
diracdec->decoder->seq_params.frame_rate,
|
||||||
gst_diracdec_chroma_to_fourcc (diracdec->decoder->
|
gst_diracdec_chroma_to_fourcc (diracdec->decoder->seq_params.
|
||||||
seq_params.chroma),
|
chroma), diracdec->decoder->seq_params.chroma));
|
||||||
diracdec->decoder->seq_params.chroma));
|
|
||||||
c = FALSE;
|
c = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,11 +191,8 @@ gst_live_adder_class_init (GstLiveAdderClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_live_adder_init (GstLiveAdder * adder, GstLiveAdderClass * klass)
|
gst_live_adder_init (GstLiveAdder * adder, GstLiveAdderClass * klass)
|
||||||
{
|
{
|
||||||
GstPadTemplate *template;
|
adder->srcpad =
|
||||||
|
gst_pad_new_from_static_template (&gst_live_adder_src_template, "src");
|
||||||
template = gst_static_pad_template_get (&gst_live_adder_src_template);
|
|
||||||
adder->srcpad = gst_pad_new_from_template (template, "src");
|
|
||||||
gst_object_unref (template);
|
|
||||||
gst_pad_set_getcaps_function (adder->srcpad,
|
gst_pad_set_getcaps_function (adder->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
||||||
gst_pad_set_setcaps_function (adder->srcpad,
|
gst_pad_set_setcaps_function (adder->srcpad,
|
||||||
|
|
|
@ -140,9 +140,8 @@ mpegpsmux_class_init (MpegPsMuxClass * klass)
|
||||||
static void
|
static void
|
||||||
mpegpsmux_init (MpegPsMux * mux, MpegPsMuxClass * g_class)
|
mpegpsmux_init (MpegPsMux * mux, MpegPsMuxClass * g_class)
|
||||||
{
|
{
|
||||||
mux->srcpad =
|
mux->srcpad = gst_pad_new_from_static_template (&mpegpsmux_src_factory,
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
"src");
|
||||||
(&mpegpsmux_src_factory), "src");
|
|
||||||
gst_pad_use_fixed_caps (mux->srcpad);
|
gst_pad_use_fixed_caps (mux->srcpad);
|
||||||
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
||||||
|
|
||||||
|
|
|
@ -295,14 +295,11 @@ gst_pnmdec_init (GstPnmdec * s, GstPnmdecClass * klass)
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
pad =
|
pad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_static_template (&gst_pnmdec_sink_pad_template, "sink");
|
||||||
(&gst_pnmdec_sink_pad_template), "sink");
|
|
||||||
gst_pad_set_chain_function (pad, gst_pnmdec_chain);
|
gst_pad_set_chain_function (pad, gst_pnmdec_chain);
|
||||||
gst_element_add_pad (GST_ELEMENT (s), pad);
|
gst_element_add_pad (GST_ELEMENT (s), pad);
|
||||||
|
|
||||||
pad =
|
pad = gst_pad_new_from_static_template (&gst_pnmdec_src_pad_template, "src");
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
|
||||||
(&gst_pnmdec_src_pad_template), "src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (s), pad);
|
gst_element_add_pad (GST_ELEMENT (s), pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,17 +216,13 @@ gst_pnmenc_init (GstPnmenc * s, GstPnmencClass * klass)
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
pad =
|
pad = gst_pad_new_from_static_template (&sink_pad_template, "sink");
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
|
||||||
(&sink_pad_template), "sink");
|
|
||||||
gst_pad_set_setcaps_function (pad, gst_pnmenc_setcaps_func_sink);
|
gst_pad_set_setcaps_function (pad, gst_pnmenc_setcaps_func_sink);
|
||||||
gst_pad_set_chain_function (pad, gst_pnmenc_chain);
|
gst_pad_set_chain_function (pad, gst_pnmenc_chain);
|
||||||
gst_pad_use_fixed_caps (pad);
|
gst_pad_use_fixed_caps (pad);
|
||||||
gst_element_add_pad (GST_ELEMENT (s), pad);
|
gst_element_add_pad (GST_ELEMENT (s), pad);
|
||||||
|
|
||||||
s->src =
|
s->src = gst_pad_new_from_static_template (&src_pad_template, "src");
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
|
||||||
(&src_pad_template), "src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (s), s->src);
|
gst_element_add_pad (GST_ELEMENT (s), s->src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue