playsink: Don't leak audio/video filters due to floating references weirdness

The filters' floating references are sinked during set_property() already,
which means that GstBin takes a new reference when adding the filter to it.
Get rid of the additional reference after adding the filter to the bin.
This commit is contained in:
Sebastian Dröge 2015-12-25 11:34:10 +01:00
parent a136ac0e2f
commit 6a57399270

View file

@ -1843,6 +1843,9 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async)
} }
gst_bin_add (bin, chain->filter); gst_bin_add (bin, chain->filter);
/* Bin takes a new reference because we sinked any
* floating reference ourselves already */
gst_object_unref (chain->filter);
if (prev) { if (prev) {
if (!gst_element_link_pads_full (prev, "src", chain->filter, "sink", if (!gst_element_link_pads_full (prev, "src", chain->filter, "sink",
GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) { GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) {
@ -2721,6 +2724,9 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw)
} }
gst_bin_add (bin, chain->filter); gst_bin_add (bin, chain->filter);
/* Bin takes a new reference because we sinked any
* floating reference ourselves already */
gst_object_unref (chain->filter);
if (prev) { if (prev) {
if (!gst_element_link_pads_full (prev, "src", chain->filter, "sink", if (!gst_element_link_pads_full (prev, "src", chain->filter, "sink",
GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) { GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) {