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 729123 - sdp: GstSdp.SDPMessage.parse_buffer needs a guint8* + annotation corrections
sdp: GstSdp.SDPMessage.parse_buffer needs a guint8* + annotation corrections
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
1.2.4
Other Linux
: Normal normal
: 1.3.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-04-28 16:08 UTC by Adrien Aubourg
Modified: 2014-09-24 08:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adrien Aubourg 2014-04-28 16:08:29 UTC
Hi,

To generated a sdpmessage from a string, one use in C the gst_sdp_message_parse_buffer function: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstsdpmessage.html#gst-sdp-message-parse-buffer

The Python introspection hence ask for a Python int. In addition, instead of returning the SDPMessage, it needs to be passed as an argument. In conclusion, the parse_buffer function cannot be called at all.

In addition, creating a SDPMessage object can be done via GstSdp.SDPMessage() or via GstSdp.SDPMessage.new(). With the former, segfault may appear when calling SDPMessage methods.

More generally, the GstSdp library may need an annotation update to be really usable with Python bindings. It may be interesting to do it before the arrival of webrtc element in gstreamer.

I'm willing to propose patches, but I can't guarantee their quality nor their arrivals.

Adrien
Comment 1 Sebastian Dröge (slomo) 2014-04-29 06:51:35 UTC
This needs some gobject-introspection annotations in the code for the parameters. For the buffer and size (array length=buffer), for the SDP message something like (out) (transfer none), but not really. More like (ref) because the message must be allocated by the caller... but there seems to be nothing like that unless I'm missing something.

In general the SDP library needs some spreading around of gobject-introspection annotations to properly work with bindings. See https://wiki.gnome.org/action/show/Projects/GObjectIntrospection/Annotations
Comment 2 Sebastian Dröge (slomo) 2014-04-29 07:03:10 UTC
Ideally all functions here should have the SDP message as first parameter, but they don't. But can't you call msg = GstSdp.SDPMessage.new() and then GstSdp.SDPMessage.parse_buffer(buffer, msg)?
Comment 3 Adrien Aubourg 2014-04-29 07:46:00 UTC
This is what is returned from introspection by ipython:

----
GstSdp.SDPMessage.parse_buffer?

Type:       FunctionInfo
String Form:gi.FunctionInfo(parse_buffer)
File:       /usr/lib/python3/dist-packages/gi/__init__.py
Docstring:  parse_buffer(data:int, size:int, msg:GstSdp.SDPMessage)
----

As you can see, there is no way to call GstSdp.SDPMessage.parse_buffer(buffer, msg) as you proposed, even by allocating a SdpMessage before. I can't see any workaround here.

I acknowledge that the whole SDP library should have its gobject-introspection
annotations updated, I had the same conclusion. Especially, some functions like new() shouldn't be used at all, and shouldn't be seen by the gobject-introspection. The bug is more general that just the parse_buffer function.

I don't know how to update the introspection annotations yet. I'll try to submit patches in a couple of weeks. As mentionned, I believe that many people would use SDPMessage once a webrtc plugin is in the gstreamer tree.
Comment 4 Sebastian Dröge (slomo) 2014-04-29 07:56:12 UTC
Does this help?
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=05ed7d5ba761c9befff8af6241f8cebb9fc419df

I'll go over the other functions this evening and add annotations as necessary. My python-gi is broken currently, have to fix that first later to actually test these things :)
Comment 5 Sebastian Dröge (slomo) 2014-05-01 13:11:46 UTC
commit cceb3303ab904d6baf4d917bb9caa0365b239c43
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Thu May 1 15:11:04 2014 +0200

    sdp: Add some more gobject-introspection annotations for bindings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729123
Comment 6 Adrien Aubourg 2014-05-14 08:05:34 UTC
Sorry for the very late answer... I've struggled to compile gstreamer to test your commits.

I'd say that the new annotations seem to make Python bindings work, especially the parse_buffer function.

But there are still several annotations to edit to make the GstSdp library binding fully working. Is there any way I can help ?
Comment 7 Sebastian Dröge (slomo) 2014-05-14 08:12:43 UTC
You can provide patches, it's not too difficult and I can help you with that. Or you can file bugs about the functions that don't work, and how they don't work (so ideally with a simple testcase) and I (or someone else) can fix it :)