From 5d3ccd65fea56bd29aec73bcefede5150ab5dc43 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Wed, 16 Sep 2026 00:30:10 -0400 Subject: [PATCH] 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. --- ui/src/main/java/dev/quoije/umd/ui/PlayerApp.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/src/main/java/dev/quoije/umd/ui/PlayerApp.java b/ui/src/main/java/dev/quoije/umd/ui/PlayerApp.java index e3d1951..19e49b3 100644 --- a/ui/src/main/java/dev/quoije/umd/ui/PlayerApp.java +++ b/ui/src/main/java/dev/quoije/umd/ui/PlayerApp.java @@ -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;