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:
@@ -200,6 +200,12 @@ public final class PlayerApp extends Application {
|
|||||||
try (UmdIsoReader iso = new UmdIsoReader(Path.of(isoPath));
|
try (UmdIsoReader iso = new UmdIsoReader(Path.of(isoPath));
|
||||||
PlaybackEngine engine = PlaybackEngine.open(iso, streamName, 0)) {
|
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);
|
Thread audio = startAudio(engine);
|
||||||
awaitClock();
|
awaitClock();
|
||||||
long basePts = clockStartPts;
|
long basePts = clockStartPts;
|
||||||
|
|||||||
Reference in New Issue
Block a user