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 751606 - audiobasesrc, audiobasesink: incorrect ringbuffer refcount when create_ringbuffer returns a non-floating ref
audiobasesrc, audiobasesink: incorrect ringbuffer refcount when create_ringbu...
Status: RESOLVED OBSOLETE
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: 751601
 
 
Reported: 2015-06-28 12:17 UTC by Michał Wróbel
Modified: 2018-11-03 11:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] audiobasesrc, audiobasesink: fix invalid refcnt with non-floating ref (1.72 KB, patch)
2015-06-28 12:29 UTC, Michał Wróbel
none Details | Review

Description Michał Wróbel 2015-06-28 12:17:28 UTC
gst_audio_base_{src,sink}_create_ringbuffer() calls the virtual function create_ringbuffer() to get a GstAudioRingBuffer, sets its parent to the GstAudioBase{Src,Sink} and returns a pointer to the ringbuffer without passing the reference (transfer none).

When create_ringbuffer() virtual function returns a floating ref (which is done by the default implementation in GstAudio{Src,Sink}), everything is fine, as the floating ref is consumed by gst_object_ref_sink() in gst_object_set_parent() and the "unfloated" ref is stored in the Src/Sink object.

However, when create_ringbuffer() virtual function returns a non-floating ref, the gst_object_ref_sink() inside gst_object_set_parent() increments the refcount which is wrong. For example, if the create_ringbuffer() vfunc returned object with refcount = 1, the gst_audio_base_{src,sink}_create_ringbuffer() returns the object with refcount = 2, while there is in fact only one ref held by the src/sink which is ringbuffer's parent.
Comment 1 Michał Wróbel 2015-06-28 12:29:12 UTC
Created attachment 306234 [details] [review]
[PATCH] audiobasesrc, audiobasesink: fix invalid refcnt with non-floating ref
Comment 2 Michał Wróbel 2015-07-22 13:31:57 UTC
Can someone please take a look at the provided patch and maybe apply it to the upstream?

This bug blocks a gstreamermm bug 751601.
Comment 3 George Kiagiadakis 2017-02-07 11:29:24 UTC
Not that I want to be an advocate of floating references (I hate them), but in this case I think there is no real problem. If create_ringbuffer() returns a ringbuffer with a non-floating reference, it means that this reference is held by the ringbuffer subclass (transfer none = the caller should not consume any existing reference), so gst_object_ref_sink will add a new reference to be held by the parent and everything is fine.
Comment 4 GStreamer system administrator 2018-11-03 11:38:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/202.