Synchronization precision

Nicolas Dufresne nicolas at
Wed Jul 3 14:57:20 UTC 2019

Le mardi 02 juillet 2019 à 11:00 -0500, RiccardoCagnasso a écrit :
> What I meant is that I recorded my laptop screen with a 120 fps camera (my
> smartphone). Crude but effective, the desync shows up nicely. 
> What you are saying about vsync makes perfectly sense to me. If a screen is
> 60hz you have a vblank every 16 ms. If two processes write images on the
> screen, without any synchronization with the vsync and with a error of about
> 2 ms between their own clocks, there will be a certain probability that two
> matching frame will be rendered after different vblanks. Which is perfectly
> consistent with what we see on camera. 
> I don't know much about wayland and freesync, but sure. If you can guarantee
> that the frame is rendered right after the vblank, this should work just
> fine. How can I help? 

As said, I haven't worked on that in the last two years. I have
uploaded my ancient branch. Back then, Arun helped me reproduce some
corner cases. Note that seeking was broken, I didn't have time to look
at this.

What it does, it implements GstWlClock, that reuses the WlDisplay
thread for async clock id. All renders now happens on the WlDisplay
thread (that was removing a lot of race with the IPC). The part that
likely need work is the scheduling. Basically it takes the render time
of a buffer and choose ahead of time which vblank will be best. It is
then scheduled for render using an async clock id. There was some
corner cases I also started to tackle, like playback 120fps over 60Hz
display and vis-versa. The hit strategy was to allow rendering half a
frame before after the running time target. That allowed me reducing
the render latency by half a frame.

One thing you need to know, is that because the render and the stream
are generally out of sync, the latency will jitter with a very specific
pattern. The problem we wanted to tackled can be well observed in ones
of Arun observation here:

Near the edge, the render goes back and forth on one vblank. At some
point, this can be more then one frame off, and that would be visible
with your camera test. Similarly, if you have two display with an out-
of-sync vblank, you will naturally have this side effect. You can find
more information on this issue:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list