Files
leaguerecorder/app/vendor/rune/scripts/check-native-pacing.py
T
vhaudiquet 5bf262b82b app: cherry-pick rune's pause and sound fixes onto the checkout
Rune comes from app/vendor/rune now, a checkout of 63ad0209 on branch
ported, carrying the four commits of upstream issues 1320 (a pause while
a clip is layered holds the layer's picture and time) and 1325 (a video's
sound is read ahead of the clock and leads it). Both were written against
eb9f1104 and ported across the refactors since. The faults are the first
two and the third in docs/rune-upstream.md; the app's workarounds in
review.rs stay until the fixes arrive upstream.
2026-11-22 22:16:30 +01:00

19 lines
985 B
Python

#!/usr/bin/env python3
"""Check a timestamp-only `pacing --native --trace FILE --frames 240` run."""
import json
import statistics
import sys
with open(sys.argv[1]) as source:
header, *frames = [json.loads(line) for line in source]
assert header['clock'] != 'virtual', 'headless timestamps cannot prove native pacing'
assert len(frames) >= 60, f'only {len(frames)} native frames'
assert sum(frame.get('quality', {}).get('animating', False) for frame in frames) >= 10, 'no spring animation'
# Exclude the first frame/initial gap, not later commit or idle-resume gaps.
gaps = [b['t'] - a['t'] for a, b in zip(frames[1:], frames[2:])]
half_refresh = 500 / header['hz']
bad = [gap for gap in gaps if gap < half_refresh - 0.01]
print(json.dumps({'frames': len(frames), 'hz': header['hz'], 'half_refresh_ms': half_refresh,
'minimum_gap_ms': min(gaps), 'median_gap_ms': statistics.median(gaps), 'short_gaps': len(bad)}, indent=2))
assert not bad, f'{len(bad)} sub-half-refresh gaps'