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 608005 - [GStreamer] Bug in VAPI-Binding for Pad.caps property
[GStreamer] Bug in VAPI-Binding for Pad.caps property
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GTK+ GStreamer WebKitGTK+
0.7.x
Other All
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-25 07:44 UTC by Sebastian Zenker
Modified: 2010-03-30 06:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix the bug, in VAPI file (622 bytes, patch)
2010-01-25 07:44 UTC, Sebastian Zenker
rejected Details | Review
gstreamer: Don't use the accessor method when accessing Gst.Pad:caps property (1.61 KB, patch)
2010-03-27 10:03 UTC, Sebastian Dröge (slomo)
none Details | Review

Description Sebastian Zenker 2010-01-25 07:44:47 UTC
Created attachment 152205 [details] [review]
Patch to fix the bug, in VAPI file

I'm using vala 0.7.9 to implement a Vala based GStreamer plugin. During development, I found a bug in the vapi-bindings for GStreamer. (in file gstreamer-0.10.vapi)

Vala expands the following expression

	outbuf.set_caps(_srcPad.caps);

to 

	gst_buffer_set_caps (outbuf, gst_pad_get_caps (self->priv->_srcPad));

instead of

	gst_buffer_set_caps (outbuf, GST_PAD_CAPS (self->priv->_srcPad));



The problem is, that the getter of the caps-property should be mapped to GST_PAD_CAPS() instead to gst_pad_get_caps().
See also
http://www.gstreamer.net/data/doc/gstreamer/head/gstreamer/html/GstPad.html#gst-pad-get-caps
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-getcaps.html

Attached, you will find a patch to solve the issue.

Cheers,
Sebastian
Comment 1 Sebastian Dröge (slomo) 2010-03-27 10:03:24 UTC
This is wrong, you shouldn't use GST_PAD_CAPS() unless you know what the pad is doing. It doesn't increase the refcount of the caps and if another thread changes the caps at the same time you could get an invalid pointer.

Either the caps property should really be used for this or gst_pad_get_negotiated_caps().

Attached patch does the first.
Comment 2 Sebastian Dröge (slomo) 2010-03-27 10:03:27 UTC
Created attachment 157269 [details] [review]
gstreamer: Don't use the accessor method when accessing Gst.Pad:caps property

Gst.Pad.get_caps() returns something completely different than the caps
property.

Fixes bug #608005.
Comment 3 Evan Nemerson 2010-03-30 06:25:35 UTC
commit 41df69cde674d9a3742bdfff3f38bcebfcd8305a
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Sat Mar 27 11:02:31 2010 +0100

    gstreamer: Don't use the accessor method when accessing Gst.Pad:caps property
    
    Gst.Pad.get_caps() returns something completely different than the caps
    property.
    
    Fixes bug #608005.