[vlc-devel] [RFC PATCH 0/2] Introduce vsync synchronisation of picture display

Julian Scheel julian at jusst.de
Thu Jun 19 11:34:20 CEST 2014

This patch series is an approach to solve the following problem I stumbled
into when working on the mmal plugins:

While the mmal video_renderer provides the latency target which is enabled
with one of my previous patches which tries to ensure that the pictures are
drawn at a sane time (mid of vsync cycle) and the hdmi clock is slightly
adjusted to be in sync with the actual video it does not take care of an
initial sync.

So in fact the first frame is drawn at a random point in time, which might be
just at a vsync boundary. From there the latency target algorithm tries to get
things in sync, but takes very long in some cases because the jittering around
a vsync time (displaying a picture right before or right after vsync) seems
not to be handled well. And even if it was the first pictures would not be
smooth anyway until the algorithm shifted things to match.
So in discussion with the broadcom/raspberry/mmal guys it turned out that
ideally the video scheduling mechanism should ensure that frames are placed at
a sane point in the vsync cycle. This is what they do in their own scheduler
To allow this in VLC I introduced a field which allows the vout to provide
back a timestamp on which vsync happened. Taking that as a base while assuming
that video and display rate basically match the vout core computes an offset
it has to apply to the timestamp it is waiting for to ensure it's placed at
25% of the vsync cycle.
Along with the mmal video output this seems to work quite good according to
our initial testings. Still I am not convinced that this approach is really
best suited and am hoping for some thoughts on it.


Julian Scheel (2):
  vout: Allow vout plugins to provide vsync time
  video_output/mmal: Provide vsync time to core

 include/vlc_vout_display.h      |  1 +
 modules/video_output/mmal.c     | 41 +++++++++++++++++++++++++++++++++++++++++
 src/video_output/video_output.c | 29 +++++++++++++++++++++++++++--
 3 files changed, 69 insertions(+), 2 deletions(-)


More information about the vlc-devel mailing list