Sync fixes: clean seeks, clock offset, end of file, 2.5 min read-ahead (proto 6)

- User seeks are intercepted at the player (SyncPlayer), previewed
  locally, sent once 300 ms after the drag ends; own echoes are matched
  by seekSeq and never re-applied; the landed check can't reapply a
  stale target. 1 s position poll removed.
- ping/pong clock offset (min-RTT ClockSync); positions use server time.
- Reports carry duration; buffer gate is min(4 s, remaining - 2 s);
  new finished transport instead of a HELD stall at the end.
- cache/readahead 150 s, 256 MiB demuxer cache, pins read back.
- Resumed reports put a stale ready member back in the set; hello.resume
  takes over the old member after an unclean drop (no ghost).
- Docs: roadmap rendering findings (HW path works; shaders verified).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-07 01:20:18 +03:00
1 parent 0669ec0fc2
commit d8d487c189
28 files changed
+1592 -237

No files matched your search

+35
View File
@@ -156,4 +156,39 @@ void main() {
expect(localPlayAllowed(state, ''), isFalse);
});
});
group('finished', () {
test('stops in place: pause, no seek to the end, no drift seeks', () {
final diff = StateDiff();
final t = DateTime.now().toUtc();
diff.diff(_state(eventId: 1, transport: 'playing', position: 100), 100, t);
final end = _state(eventId: 2, transport: 'finished', position: 120);
final actions = diff.diff(end, 119.4, t);
expect(actions.whereType<SeekAction>(), isEmpty);
expect(actions.whereType<TransportAction>().single.playing, isFalse);
// Far off and later: still nothing.
expect(diff.diff(end, 50, t.add(const Duration(seconds: 10))), isEmpty);
});
test('late joiner lands just before the end, paused', () {
final diff = StateDiff();
final actions = diff.diff(
_state(eventId: 5, transport: 'finished', position: 120), 0,
DateTime.now().toUtc());
expect(actions.whereType<SeekAction>().single.position, 119);
expect(actions.whereType<TransportAction>().single.playing, isFalse);
});
});
test('serverPositionAt extrapolates on the server clock', () {
final st = StateBroadcast(
eventId: 1,
transport: 'playing',
position: 10,
serverTime: DateTime.utc(2026, 1, 1, 12),
mediaId: 1,
members: const [],
);
expect(serverPositionAt(st, DateTime.utc(2026, 1, 1, 12, 0, 2, 500)), 12.5);
});
}