forge
Explore
Log in

Don't you dare go Hollow

Playout clock resyncs when sharer timestamps restart

Browse files at this commit

6fb72ce21b03d7a766c838033eac0d600e3591c8Ahmet Kaan GümüşParent: a47f782
  • test
    • playout clock resyncs when sharer timestamps restart
Show full message
✅ test: playout clock resyncs when sharer timestamps restart
crates/client/src/share/session.rsmodified+13 -0
@@ -1137,6 +1137,19 @@ fn flush(
1137 mod tests {1137 mod tests {
1138 use super::*;1138 use super::*;
1139 1139
1140+ #[test]
1141+ fn clock_follows_sharer_restart() {
1142+ let clock = Clock {
1143+ started: Instant::now(),
1144+ offset: AtomicI64::new(i64::MAX),
1145+ delay: AtomicI64::new(INITIAL_DELAY_MS),
1146+ };
1147+ clock.observe(116_000);
1148+ assert!((clock.now() - clock.origin(116_000)).abs() < 50);
1149+ clock.observe(0);
1150+ assert!((clock.now() - clock.origin(0)).abs() < 50);
1151+ }
1152+
1140 #[test]1153 #[test]
1141 fn every_codec_round_trips() {1154 fn every_codec_round_trips() {
1142 let capabilities = encode::capabilities();1155 let capabilities = encode::capabilities();