GNOME Bugzilla – Bug 741390
playbin: leaks custom sink
Last modified: 2014-12-30 11:43:12 UTC
Created attachment 292521 [details] Python example Using playbin in combination with a custom sink just containing GstFakeSink leaks: * 1 GstFakeSink * 1 GstGhostPad * 1 GstProxyPad * 1 GstPad See the attached example. I followed the tutorial at http://docs.gstreamer.com/display/GstSDK/Playback+tutorial+7%3A+Custom+playbin2+sinks but I am using GStreamer 1.x trunk (this includes the recent fix for bug 741198)
Does it still happen if you simplify it to not use a GstBin with the fakesink inside?
You mean just setting "audio-sink" to GstFakeSink? No, this doesn't leak (with trunk at least) Maybe the tutorial is missing some necessary cleanup step?
It might be a bug in the Python bindings too, or a side effect of bindings usually not having floating references. Maybe the tutorial code also fails if the sink-bin gets ref_sink() before setting it on playbin.
Thanks, I'll try with a C version. Note that GstBin doesn't get leaked in this case.
Created attachment 292969 [details] C example Here is a C version. In case I haven't forgotten anything this only leaks one GstPad per iteration.
The code is correct, so it's a bug in playbin somewhere :)
I don't see any obvious wrong in playbin and playsink with the handling of the sinkpads of audio/video/text sinks. It's leaking the ghostpad, right?
No, just a GstPad. As with bug 741198 I've used the new "instance-count" + GtkInspector to see the amount of alive GObject instances. Not sure how accurate this is...
Ah, I did too much copy pasting here and compiled/linked the C example against 0.10. 1.0 trunk doesn't leak. So this is either an annotation or pygobject bug. sorry :/
Manually unrefing the ghostpad and sink after adding them to GstBin fixes the leak.
Created attachment 293360 [details] [review] patch-v1 Fix binding leak with gst_element_add_pad() and gst_bin_add(). They both ref the GstObject by setting a parent or do nothing. No ownership transfer, so change to none. https://bugzilla.gnome.org/show_bug.cgi?id=741390
*** This bug has been marked as a duplicate of bug 702960 ***