• Edward Hervey's avatar
    systemclock: Use clock_nanosleep for higher accuracy · 17feeb1b
    Edward Hervey authored
    The various wait implementation have a latency ranging from 50 to 500+
    microseconds. While this is not a major issue when dealing with a low number of
    waits per second (for ex: video), it does introduce a non-negligeable jitter for
    synchronization of higher packet rate systems.
    
    The `clock_nanosleep` syscall does offer a lower-latency waiting system but is
    unfortunately blocking, so we don't want to use it in all scenarios nor for too
    long.
    
    This patch makes GstSystemClock use clock_nanosleep (if available) as such:
    * Any wait below 500us uses it
    * Any wait below 2ms will first use the regular waiting system and then
      clock_nanosleep
    
      #	modified:   gst/gstsystemclock.c
    
    Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/688>
    17feeb1b