After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741390 - playbin: leaks custom sink
playbin: leaks custom sink
Status: RESOLVED DUPLICATE of bug 702960
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-12-11 11:17 UTC by Christoph Reiter (lazka)
Modified: 2014-12-30 11:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Python example (903 bytes, text/x-python)
2014-12-11 11:17 UTC, Christoph Reiter (lazka)
  Details
C example (1.43 KB, text/plain)
2014-12-18 11:20 UTC, Christoph Reiter (lazka)
  Details
patch-v1 (2.17 KB, patch)
2014-12-26 17:11 UTC, Christoph Reiter (lazka)
none Details | Review

Description Christoph Reiter (lazka) 2014-12-11 11:17:23 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)
Comment 1 Thiago Sousa Santos 2014-12-18 03:18:50 UTC
Does it still happen if you simplify it to not use a GstBin with the fakesink inside?
Comment 2 Christoph Reiter (lazka) 2014-12-18 08:40:48 UTC
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?
Comment 3 Sebastian Dröge (slomo) 2014-12-18 09:13:26 UTC
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.
Comment 4 Christoph Reiter (lazka) 2014-12-18 09:30:06 UTC
Thanks, I'll try with a C version. Note that GstBin doesn't get leaked in this case.
Comment 5 Christoph Reiter (lazka) 2014-12-18 11:20:43 UTC
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.
Comment 6 Sebastian Dröge (slomo) 2014-12-18 11:36:09 UTC
The code is correct, so it's a bug in playbin somewhere :)
Comment 7 Sebastian Dröge (slomo) 2014-12-18 11:38:55 UTC
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?
Comment 8 Christoph Reiter (lazka) 2014-12-18 12:27:22 UTC
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...
Comment 9 Christoph Reiter (lazka) 2014-12-26 15:10:14 UTC
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 :/
Comment 10 Christoph Reiter (lazka) 2014-12-26 15:30:00 UTC
Manually unrefing the ghostpad and sink after adding them to GstBin fixes the leak.
Comment 11 Christoph Reiter (lazka) 2014-12-26 17:11:31 UTC
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
Comment 12 Christoph Reiter (lazka) 2014-12-30 11:43:12 UTC

*** This bug has been marked as a duplicate of bug 702960 ***