mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 17:45:40 +00:00
* Prevenet anachronous sample reading. Not so pretty way of solving this. Please let me know if you have thoughts. Passing in time allows testing easier. But, that also leads to time reversal problems. Example scenario 1. Connection stats worker gets a time and initiates quality calculation. 2. A layer transition is recorded after that. 3. By the time, scorer is called to calculate score with time from Step 1, there is time reversal and results in anachronous sample. One option is to use a scorer lock in connection stats module and wrap all calls to scorer in that lock, but that does not prevent the passed in time stamps themselves getting out of order. Also, stand alond use of scorer in some other context will be problematic. Doing the hybrid thing of taking current time in scorer if passed in time is zero so that scorer lock domain controls it. * use zero time everywhere in normal flow * make APIs with and without time passed in as Paul suggested