hls.js 1.6.0-beta.1.0.canary.10810 → 1.6.0-beta.1.0.canary.10811

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -130,5 +130,5 @@
130
130
  "url-toolkit": "2.2.5",
131
131
  "wrangler": "3.91.0"
132
132
  },
133
- "version": "1.6.0-beta.1.0.canary.10810"
133
+ "version": "1.6.0-beta.1.0.canary.10811"
134
134
  }
@@ -100,20 +100,24 @@ export default class MP4Remuxer implements Remuxer {
100
100
  this.videoTrackConfig = undefined;
101
101
  }
102
102
 
103
- getVideoStartPts(videoSamples) {
103
+ getVideoStartPts(videoSamples: VideoSample[]) {
104
+ // Get the minimum PTS value relative to the first sample's PTS, normalized for 33-bit wrapping
104
105
  let rolloverDetected = false;
106
+ const firstPts = videoSamples[0].pts;
105
107
  const startPTS = videoSamples.reduce((minPTS, sample) => {
106
- const delta = sample.pts - minPTS;
108
+ let pts = sample.pts;
109
+ let delta = pts - minPTS;
107
110
  if (delta < -4294967296) {
108
111
  // 2^32, see PTSNormalize for reasoning, but we're hitting a rollover here, and we don't want that to impact the timeOffset calculation
109
112
  rolloverDetected = true;
110
- return normalizePts(minPTS, sample.pts);
111
- } else if (delta > 0) {
113
+ pts = normalizePts(pts, firstPts);
114
+ delta = pts - minPTS;
115
+ }
116
+ if (delta > 0) {
112
117
  return minPTS;
113
- } else {
114
- return sample.pts;
115
118
  }
116
- }, videoSamples[0].pts);
119
+ return pts;
120
+ }, firstPts);
117
121
  if (rolloverDetected) {
118
122
  this.logger.debug('PTS rollover detected');
119
123
  }