Gstreamer bus calls i.c.w. python multiprocessing cause X server errors in Ubuntu

491 views Asked by At

I have written a video player in gstreamer as specified here: https://github.com/dschreij/media_player_gst/blob/master/media_player_gst.py

In Windows it works fine in 'normal' and multiprocessing mode (that is all Gstreamer parts and the player object are created in a separate process). In Ubuntu 13.10, however, when the player run in its own process a call to

self.bus.peek()  # Reference to the playbin2 player's bus

causes the following error and crashes the whole program (also parent process):

python: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
python: Fatal IO error 4 (Interrupted system call) on X server :0.

The player otherwise runs fine in a new process. Only the call to self.bus.peek() makes it crash. I needed to check for events on the bus queue itself, because connecting the bus to a function that handles its messages also didn't seem to work (only in Ubuntu again!)

Basically I only use the bus to see if the end of stream (gst.MESSAGE_EOS) has been reached, so if it is possible to determine this without using the playbin2 bus, I'm fine with such a solution too. Is there anyone who could help me out with this?

1

There are 1 answers

0
Daniel Schreij On

I found the answer in the mean time mainly in this thread:

http://gstreamer-devel.966125.n4.nabble.com/fork-and-then-use-gstreamer-functions-td972935.html

Using gstreamer in forked processes is a drag, because there might be conflicts of access regarding the gst main loop and resources involved. However, gst.Bus.pop() does not interact with the internal gst loop structure (which both peek() and poll() do aparently) and by using gst.Bus.pop() I was able to retrieve messages from the bus without problems!