Skip to content

qmlglsrc: sync on the streaming thread

Matthias Fuchs requested to merge uboot/gstreamer:fix-qmlglsrc-race into main

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.

Merge request reports