GNOME Bugzilla – Bug 747555
python -c 'from gi.repository import Gst; Gst.Caps.from_string("video/x-raw,format=RGB")' crashes
Last modified: 2015-04-24 07:24:59 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.
+ Trace 234951
also: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1442051 ....
Have you tried calling Gst.Init(None,None) ?
nope.
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>
Right. It works for me with the init. It's annoying when the ipython shell crashes, though.
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?
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.
(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
> 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).
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):
+ Trace 234997
raise NotInitalized("Please call Gst.init(argv) before using GStreamer") gi.overrides.Gst.NotInitalized: Please call Gst.init(argv) before using GStreamer
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
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