This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Segfault using GStreamer in a Python plasmoid

Tags: None
(comma "," separated)
User avatar
hipersayan_x
Registered Member
Posts
5
Karma
0
OS
Hello, I'm working on a plasmoid for the webcam (maybe somebody know it).
Recently, I switched to gst-python for webcam capture and apply some video effects using GStreamer. All the code for webcam managing is in this file.
Based on this example, when the user clicks the play/stop button, I dinamically import and initialize the GStreamer library only once (lines 379-411), then create the pipeline (lines 413-471) and play it (line 525). All captured frames are processed by the readFrame() method (lines 545-555).
I can start the webcam widget (without the plasmoid container) with:

Code: Select all
cd Webcamoid/contents/code
python2 -B webcamoidgui.py
# Click in the play/stop button


And it works fine, but when I try to start the plasmoid using plasmoidviewer from the root directory, by click in the play/stop button, it crashes with the following message:

** Message: pygobject_register_sinkfunc is deprecated (GstObject)
plasmoidviewer: Fatal IO error: client killed
KCrash: Application 'plasmoidviewer' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/hipersayan_x/.kde4/socket-localhost/kdeinit4__0
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Unable to start Dr. Konqi


Wich is basically, a segfault after self.camerabin.set_state(self.gst.STATE_PLAYING) is called and before readFrame(), from many test I did before, I arrived to the conclusion that the problem occurs in the gobject threads and, I think that this problem is caused because the gobject threads are initialized inside the Plasma thread.
I searched for source code in other plasmoids (C++ and Python) but it appears that nobody had working on this kind of hacks.
Sorry for coming with this extensive question, but at this point I'm stucked, seriously, I haven't idea what to do.
Is there a way in wich I can initialize the gobject threads before the Plasma threads? Or any other idea to fix this issue?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I would recommend asking about this on plasma-devel@kde.org. However, I suspect that it is not possible to start the GObject threads before Plasma commences it start procedures. This would definitely be the case with Plasma Desktop itself.

I suspect you may be able to start the threads in another manner however.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
hipersayan_x
Registered Member
Posts
5
Karma
0
OS
Thank, I will ask in the mailing list :)

bcooksley wrote:I suspect you may be able to start the threads in another manner however.


For now, I'm using GStreamer with gst-launch. This is not the best solution, but at least works.
I'm still interested in an answer for this question.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient