mirror of
https://github.com/YusufB5/ASCILINE.git
synced 2026-06-17 22:35:13 +02:00
Cold-start root cause: on a slow first load the <audio> element starts late, so the audio-ready gate's wall-clock fallback has already advanced playback a second or two by the time audio finally begins at currentTime≈0. The master clock then snapped back toward 0, every buffered frame read as "in the future", and renderFrame() deadlocked until audio caught up — the freeze. A refresh warms the cache, audio starts immediately, the gap (and the freeze) vanish — which is why reloading "fixes" it. Fix: the first time audio is genuinely playing, capture the offset between the wall clock and the audio clock and add it back, so the master clock follows audio's *rate* without ever moving backward. When audio starts promptly the offset is ~0, so normal playback is unchanged. experiments/freeze_repro.js models a 2s-late audio start with a realistic jitter buffer + 60fps render loop: the original code and a naive `currentTime > 0` guard render 0-1 of ~96 frames after audio starts (frozen ~4s); the anchored clock renders 96/96 smooth. Real-browser regression (muted Chrome): normal playback unaffected at ~29 fps. |
||
|---|---|---|
| .. | ||
| check_vectors.js | ||
| freeze_repro.js | ||
| gen_vectors.py | ||
| make_test_clips.sh | ||
| test_e2e.js | ||