srobo / srcomp-mixtape

A service which plays tracks throughout a competition.
0 stars 2 forks source link

No handling of clock drift #22

Open PeterJCLaw opened 1 year ago

PeterJCLaw commented 1 year ago

Currently mixtape doesn't seem to have any means to ensure that its actions are actually in sync with the events in the arena. Those are handled by NTP sync between the compbox and the various displays, which ensures that their clocks align. Alternatively the website, which can't rely on NTP (since we don't control the host browser in such cases), has direct handling of this at the application level -- i.e: implementing its own approximation of NTP to adjust the displayed events relative to the local clock.

Perhaps it's just not documented, but mixtape doesn't appear to have either of these. There is a fixed latency parameter, however from memory that's intended to cope with the latencies within the operation of e.g: lights actually spinning up rather than clock drift. Given its fixed nature it doesn't feel like a great solution anyway.

~A possibly related thing here is that mixtape appears to sort-of rely on the event stream as a means of timing, which the event stream isn't really capable of providing. The event stream only checks for new events to issue every couple of seconds, which is actually quite large relative to the duration of a match (typically 100-200 seconds). Given that humans can easily perceive desyncs in the order of tens of milliseconds another source of timings is probably warranted.~ (moved this part to https://github.com/srobo/srcomp-mixtape/issues/23)