x42 / ltc-tools

tools to deal with linear-timecode (LTC)
GNU General Public License v2.0
71 stars 20 forks source link

Bug 17: 'Received' timestamp from within 'process()' and use 'off_start' for each packet. #18

Closed mungewell closed 3 years ago

mungewell commented 4 years ago

Bug #17 Improves the accuracy of the 'Received' timestamps when using SHM to NTP/Chrony.

x42 commented 4 years ago

Keep in mind that the jack process callback will be called at some undefined time each cycle.

the time returned by gettimeofday will jitter by the period-size. -- you could try to correct this by using jack_frames_since_cycle_start or use jack's time API instead: https://jackaudio.org/api/group__TimeFunctions.html

mungewell commented 4 years ago

Interesting.

I had looked at 'jack_last_frame_time()' before but rejected as the relationship between sample clock and system clock was unknown... and perhaps convoluted by the fact that Chrony was pulling the system clock around.

The plot seems to show that gettimeofday() is reporting consistantly (on a mostly idle system). But I'll experiment blending jack_frames_since_cycle_start() to gettimeofday() and report whether it improves situation....

I also noticed that the buffer length is quite small (1024 bytes) meaning that there are only a couple of LTC packets in each cycle. An interesting experiment would be to use a larger buffer (at the cost of latency) but then see if closely coupled LTC packets show the same jittering - ie. implying that the problem lies outside of LibLTC.

dimitry-ishenko commented 3 years ago

@x42 this is superseded by PR #25.

Few notes:

x42 commented 3 years ago

Superseded by PR #25.