Catching XIO error in gst python

Pavel Hofman pavel.hofman at ivitera.com
Sat Jan 2 13:12:29 UTC 2021


Hi,
Dne 31. 12. 20 v 14:31 Pavel Hofman napsal(a):
> Hi,
> 
> I am starting a gstreamer video window in python Gst, waiting for the
> ERROR and EOS messages as described in all the docs
> 
> msg = bus.timed_pop_filtered(
>     Gst.CLOCK_TIME_NONE,
>     Gst.MessageType.ERROR | Gst.MessageType.EOS
> )
> 
> 
> When the video window is closed (Alt+F4, mouse click), the python
> program exits without leaving the timed_pop_filtered function, with
> error message:
> 
> XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server
> ":0.0" after 142 requests (68 known processed) with 1 events remaining.
> 
> 
> 
> As a result the python code does not run my exit handler which must kill
> some extra processes running on the background (unclutter hiding mouse
> cursor).
> 
> Please what is the proper way of exiting a Gst python application so
> that the exit handler can be called?
> 


I tried to move the Gst code into a python thread, hoping that closing
the vaapisink X.org window would kill only that thread, allowing the
main application thread to do the cleanup. Unfortunately the whole
application gets killed when the vaapisink window is closed, without the
signal handler being called.

IIUC the Alt+F4 (or close button) should just make the window manager to
send SIGINT to the window process which should be caught by
signal(signal.SIGINT, exit_handler). But it is not.

I could run the cursor-hiding process from bash, wrapping the python
application, but I would like to run everything from the main python
app, if possible.

Thanks a lot in advance for any hints.

Best regards,

Pavel.


More information about the gstreamer-devel mailing list