Re-anchor the A/V clock for each stream

The master clock was anchored once to the first stream's audio PTS, but
every stream starts its own PTS timeline (~90000). Subsequent streams were
paced against the stale anchor, so their targets were all in the past and
the video free-ran to catch up (the reported speed-up / poor fps). Reset
the clock anchor when each stream starts.
This commit is contained in:
2026-09-16 00:30:10 -04:00
parent 54adf8d326
commit 5d3ccd65fe
@@ -200,6 +200,12 @@ public final class PlayerApp extends Application {
try (UmdIsoReader iso = new UmdIsoReader(Path.of(isoPath));
PlaybackEngine engine = PlaybackEngine.open(iso, streamName, 0)) {
// Each stream has its own PTS timeline, so re-anchor the master
// clock to this stream's first audio chunk.
clockStartPts = -1;
clockStartNanos = -1;
clockOffsetNanos = 0;
Thread audio = startAudio(engine);
awaitClock();
long basePts = clockStartPts;