python - Multithreaded Gstreamer w/ PyGTK crashing (xcb_xlib_threads_sequence_lost) -


i understand 1 not supposed update ui other threads in gtk, or face consequences, not sure how can avoid while using gstreamer.

my application crashes time time during video stream initialization following complaint:

[xcb] unknown sequence number while processing queue [xcb] multi-threaded client , xinitthreads has not been called [xcb] aborting, sorry that. python: ../../src/xcb_io.c:274: poll_for_event: assertion `!xcb_xlib_threads_sequence_lost' failed. 

in code have added gtk.thread_init() call right in beginning of gui class:

import pygtk, gtk, gobject gtk.gdk.threads_init() 

(i have tried gobject.threads_init(), doesnt seem different). in separate class, run in separate thread, start gstreamer stream tcpserversink (this gstreamer thread third thread, if keeping count). , thread receives data before pushing data xvimagesink in end.

the xvimagesink needs viewport, , believe gstreamer callback function gtk goes crazy, when assign it:

def on_sync_message(self, bus, message): ... if message_name == "prepare-xwindow-id":    # assign viewport   imagesink = message.src   imagesink.set_property("force-aspect-ratio", true)   imagesink.set_xwindow_id(self.window_handle.window.xid) 

the self.window_handle pointer self.movie_window = gtk.drawingarea(), assigned during gui initialization.

tl;dr there safe way of using gtk gstreamer, since cannot avoid threading when calling gst.pipeline("name").set_state(gst.state_playing) , view gtk drawing area ?

i think issue fact accessing unprotected xlib/xcb 2 threads - once impicitly gtk+ ui , once in thread gstreamer backend callback executed - default mainloop told gstreamer use (or thread default mainloop).


gtk.gdk.threads_init() called once type system initialized (if recall correctly, correct me if wrong).


use g_idle_add (or use gsource higher priority) (which threadsafe) callback schedules ui changes in gtk mainloop (run gtk_main()).


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -