GNOME Bugzilla – Bug 691421
osxvideosink doesn't wait for xwindow-id in Qt-based application
Last modified: 2013-01-10 12:24:25 UTC
osxvideosink doesn't wait for xwindow-id after posting "prepare-xwindow-id" on a bus and creates its internal window. I suffer this problem in Qt-based application, so the problem seems to be in non-Glib mainloop of application (Qt uses AppKit in its Mac version). I also rotate Glib mainloop using gst_main_context_iteration() and QTimer with timeout 0. The problem is particularly serious as osxvideosink also handles window-id assignment incorrectly (described in bug #691419).
Do you catch the prepare-xwindow-id message from a sync bus handler and set the window id from there? Or do you use a normal (async) message handler?
I catch it in async message handler (set using gst_bus_add_watch()). I also thought of sync handler, but as documentation reads, it's mainly for plugin developers and not for application, so I refused to do this way. Interesting that xvimagesink always manages to receive window-id while the code is quite similar (window-id check is almost right after posting bus message).
You must do it from a sync message handler for this message as written in the xoverlay/videooverlay documentation. Otherwise this will sometimes work, sometimes not. The sink requires the window id to be set after gst_element_post_message() returned, and this is only guaranteed with a sync handler.