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 747555 - python -c 'from gi.repository import Gst; Gst.Caps.from_string("video/x-raw,format=RGB")' crashes
python -c 'from gi.repository import Gst; Gst.Caps.from_string("video/x-raw,f...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
1.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-09 12:39 UTC by Tobias Mueller
Modified: 2015-04-24 07:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tobias Mueller 2015-04-09 12:39:12 UTC
This may be more gobject-introspection's fault, feel free to re-assign.

python -c 'from gi.repository import Gst; Gst.Caps.from_string("video/x-raw,format=RGB")'
crashes for me.

Caps.from_string("image/png") too.
Comment 1 Tobias Mueller 2015-04-09 12:40:48 UTC


  • #0 gst_mini_object_init
    from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
  • #1 gst_caps_new_empty
    from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
  • #2 gst_caps_from_string
    from /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
  • #3 ffi_call_unix64
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #4 ffi_call
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #5 ??
    from /usr/lib/python2.7/dist-packages/gi/_gi.so
  • #6 ??
    from /usr/lib/python2.7/dist-packages/gi/_gi.so
  • #7 PyObject_Call
    at ../Objects/abstract.c line 2529
  • #8 do_call
    at ../Python/ceval.c line 4251
  • #9 call_function
    at ../Python/ceval.c line 4056
  • #10 PyEval_EvalFrameEx
    at ../Python/ceval.c line 2679


also:  https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1442051
....
Comment 2 Tim-Philipp Müller 2015-04-09 12:52:35 UTC
Have you tried calling Gst.Init(None,None) ?
Comment 3 Tobias Mueller 2015-04-09 12:53:14 UTC
nope.
Comment 4 Tim-Philipp Müller 2015-04-09 13:03:26 UTC
Please try it then!

$ python -c 'from gi.repository import Gst; Gst.Caps.from_string("video/x-raw,format=RGB")'
Segmentation fault

$ python -c 'from gi.repository import Gst; Gst.init(None); print Gst.Caps.from_string("video/x-raw,format=RGB")'
<GstCaps at 0x135f590>
Comment 5 Tobias Mueller 2015-04-09 13:39:55 UTC
Right. It works for me with the init.

It's annoying when the ipython shell crashes, though.
Comment 6 Olivier Crête 2015-04-09 16:49:31 UTC
I wonder if we could do a clever thing with the overrides to either emit an exception if Gst.init() hasn't been called, or maybe just call it?
Comment 7 Tobias Mueller 2015-04-09 17:15:40 UTC
It's certainly possible to "hide" the real API until init() has been called. In Python at least.  And I think it's way better than to crash.

I don't know much about pygi in order to assess whether this is feasible, though.
Comment 8 Thibault Saunier 2015-04-10 09:00:07 UTC
(In reply to Olivier Crête from comment #6)
> I wonder if we could do a clever thing with the overrides to either emit an
> exception if Gst.init() hasn't been called, or maybe just call it?

I implemented that here: http://phabricator.freedesktop.org/D87
Comment 9 Tim-Philipp Müller 2015-04-23 23:57:28 UTC
> I implemented that here: http://phabricator.freedesktop.org/D87

So what's happening with that? Now we have two bugs in two bug trackers... can we close this one (it's a WONTFIX for me for the C API).
Comment 10 Thibault Saunier 2015-04-24 07:13:39 UTC
Ah, sorry forgot to close the bug.

So now if the user forget to init Gst we raise an issue like:

$ python3 -c "from gi.repository import Gst; print(Gst.Structure.from_string('video/x-raw,framerate=10/1')[0]['framerate'])"               
Traceback (most recent call last):
  • File "<string>", line 1 in <module>
  • File "/home/thiblahute/devel/pitivi/1.0-uninstalled/gst-python/gi/overrides/Gst.py", line 347 in fake_method
    raise NotInitalized("Please call Gst.init(argv) before using GStreamer") gi.overrides.Gst.NotInitalized: Please call Gst.init(argv) before using GStreamer

Comment 11 Thibault Saunier 2015-04-24 07:14:20 UTC
commit 44931ffd9b77f0a591858bc54a104dedff3cce98
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Wed Apr 15 19:55:16 2015 +0200

    overrides: Disable all GStreamer APIs until Gst has been initialized
    
    Summary:
    And throw an exception if the user tries to call any Gst API without
    initializing gst.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747555
    
    Reviewers: Mathieu_Du
    
    Differential Revision: http://phabricator.freedesktop.org/D87
Comment 12 Thibault Saunier 2015-04-24 07:24:59 UTC
Actually I had not pushed those commit, it is done now:

commit d97662ad41e4506b4df29d66bc23607ab091aa4a
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Wed Apr 15 19:57:43 2015 +0200

    test: Bring back the testsuite and test if the initialization override works
    
    Summary:
    Simplify the Makefile taking example on pitivi and copy several pitivi
    testing files, simplifying them a bit for our use case
    
    Reviewers: Mathieu_Du
    
    Differential Revision: http://phabricator.freedesktop.org/D97

commit 6b32ccbbb250f7516f36a1ea82c0fbba8925af09
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Wed Apr 15 19:55:16 2015 +0200

    overrides: Disable all GStreamer APIs until Gst has been initialized
    
    Summary:
    And throw an exception if the user tries to call any Gst API without
    initializing gst.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747555
    
    Reviewers: Mathieu_Du
    
    Differential Revision: http://phabricator.freedesktop.org/D87