[gstreamer-bugs] [Bug 596078] Playbin2 takes ref of audio-/video-sink parameter

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Sep 29 02:56:30 PDT 2009


https://bugzilla.gnome.org/show_bug.cgi?id=596078
  GStreamer | gst-plugins-base | git

--- Comment #12 from Jan Schmidt <thaytan at mad.scientist.com> 2009-09-29 09:56:23 UTC ---
There's still a problem with both of these patches applied, which is that
playbin2 takes ownership of the floating reference if the caller hasn't
already.

That means that the naive test case above is still incorrect - the caller lost
their reference to the element (the floating reference), but it happens to be
OK because playbin2 held onto an extra reference by dup'ing the object.

If the caller had sunk the floating reference before passing the element to
playbin2, then it's:

   g_value_dup_object ()  (refcount += 1)
   gst_object_ref_sink () (floating ref was gone, so refcount += 1)

Now playbin2 owns 2 references to the element but will only drop one.

As far as I can see, there is no way to avoid having playbin2 sink the floating
reference either, because if it adds the element to a bin, then the GstBin will
take ownership regardless.

I think the moral of the story is that playbin2 is already doing the only thing
it can, however bad that might be for bindings. If applications need to keep a
reference to the passed element, they should ref and sink it first themselves.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.




More information about the Gstreamer-bugs mailing list