Keep initPTS across the chunks of a progressive multi-moof segment
In progressive mode every chunk of a segment is remuxed with the segment's timeOffset, so only the first chunk's decode time lines up with it. A second moof starting further into the segment was treated as a new initPTS and appended over the chunks before it, stalling playback. Fixes #5697
This commit is contained in:
1 parent
2ac5311ec5
commit
155a6b6c90
2 files changed
+65
-2
No files matched your search
@@ -49,6 +49,7 @@ class PassThroughRemuxer extends Logger implements Remuxer {
|
||||
private initPTS: TimestampOffset | null = null;
|
||||
private initTracks?: TrackSet;
|
||||
private lastEndTime: number | null = null;
|
||||
private lastChunkKey: string | null = null;
|
||||
private isVideoContiguous: boolean = false;
|
||||
private videoOnlyRemux: boolean = false;
|
||||
private decryptdata: DecryptData | null = null;
|
||||
@@ -74,6 +75,7 @@ class PassThroughRemuxer extends Logger implements Remuxer {
|
||||
|
||||
public resetTimeStamp(defaultInitPTS: TimestampOffset | null) {
|
||||
this.lastEndTime = null;
|
||||
this.lastChunkKey = null;
|
||||
const initPTS = this.initPTS;
|
||||
if (initPTS && defaultInitPTS) {
|
||||
if (
|
||||
@@ -89,6 +91,7 @@ class PassThroughRemuxer extends Logger implements Remuxer {
|
||||
public resetNextTimestamp() {
|
||||
this.isVideoContiguous = false;
|
||||
this.lastEndTime = null;
|
||||
this.lastChunkKey = null;
|
||||
}
|
||||
|
||||
public resetInitSegment(
|
||||
@@ -441,8 +444,14 @@ class PassThroughRemuxer extends Logger implements Remuxer {
|
||||
|
||||
decodeTime = baseOffsetSamples.start / timescale;
|
||||
|
||||
// Every chunk of a progressive segment is remuxed with the segment's
|
||||
// timeOffset, so only the first chunk's decode time lines up with it
|
||||
const chunkKey = `${chunkMeta.level}_${chunkMeta.sn}_${chunkMeta.part}`;
|
||||
const segmentStart = chunkKey !== this.lastChunkKey;
|
||||
this.lastChunkKey = chunkKey;
|
||||
|
||||
if (
|
||||
(accurateTimeOffset || !initPTS) &&
|
||||
((accurateTimeOffset && segmentStart) || !initPTS) &&
|
||||
(isInvalidInitPts(initPTS, decodeTime, timeOffset, duration) ||
|
||||
timescale !== initPTS.timescale)
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user