qmlglsrc: sync on the streaming thread
authorMatthias Fuchs <matthias1.fuchs@zeiss.com>
Tue, 17 Oct 2023 13:24:22 +0000 (15:24 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 20 Oct 2023 00:36:26 +0000 (00:36 +0000)
commit7c49ce1c217d607e929594d7b9d07e5e812cc51e
tree1c0365a0ffeb6db62e13b623c92bc2141fad3fb9
parent61c62919a7b3c55d5a91d9bdd7d549bd78dcbd45
qmlglsrc: sync on the streaming thread

After rendering a QML scene the qmlglsrc element copies the contents of
the scene to a GStreamer buffer. This happens on the Qt render thread.
Then it attaches a sync point to the destination buffer. This sync point
must be awaited by other threads which use the buffer later on. The
current implementation relies on the downstream elements to wait for the
sync point. However, there are situation where this does not work. The
GstBaseTransform e.g. copies the buffer metadata (which overwrites the
sync point without waiting for it) *before* waiting for the sync point.

This commit waits for the sync point inside the qmlglsrc element before
sending it downstream. The wait command is issued on the streaming
thread with the pipeline OpenGL context, i.e. it will synchronize with
the GStreamer OpenGL thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5515>
subprojects/gst-plugins-good/ext/qt/gstqtsrc.cc