Files
livekit/pkg/utils
David Zhao 17236799bb Fix handling of non-monotonic timestamps (#1304)
* Fix handling of non-monotonic timestamps

Timed version is inspired by Hybrid Clock. We used to have a mixed behavior
by using time.Time:
* during local comparisons, it does increment monotonically
* when deserializing remote timestamps, we lose that attribute

So it's possible for two requests to be sent in the same microsecond, and
for the latter one to be dropped.

To fix that behavior, I'm switching it to keeping timestamps to consolidate
that behavior, and accepting multiple updates in the same ms by incrementing ticks.

Also using @paulwe's idea of a version generator.
2023-01-12 11:57:26 -08:00
..