Skip to content

Commit

Permalink
Fix issue #3359 (MSS timestamp offset with timestamps > 2^53) (#3368)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbert authored Aug 20, 2020
1 parent a586d47 commit 1815117
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ function MssParser(config) {
for (i = 0; i < adaptations.length; i++) {
if (adaptations[i].contentType === constants.AUDIO || adaptations[i].contentType === constants.VIDEO) {
segments = adaptations[i].SegmentTemplate.SegmentTimeline.S_asArray;
startTime = segments[0].t / adaptations[i].SegmentTemplate.timescale;
startTime = segments[0].t;
if (timestampOffset === undefined) {
timestampOffset = startTime;
}
Expand All @@ -772,16 +772,16 @@ function MssParser(config) {
}
}
}
// Patch segment templates timestamps and determine period start time (since audio/video should not be aligned to 0)
if (timestampOffset > 0) {
// Patch segment templates timestamps and determine period start time (since audio/video should not be aligned to 0)
manifest.timestampOffset = timestampOffset;
for (i = 0; i < adaptations.length; i++) {
segments = adaptations[i].SegmentTemplate.SegmentTimeline.S_asArray;
for (j = 0; j < segments.length; j++) {
if (!segments[j].tManifest) {
segments[j].tManifest = segments[j].t;
segments[j].tManifest = segments[j].t.toString();
}
segments[j].t -= (timestampOffset * adaptations[i].SegmentTemplate.timescale);
segments[j].t -= timestampOffset;
}
if (adaptations[i].contentType === constants.AUDIO || adaptations[i].contentType === constants.VIDEO) {
period.start = Math.max(segments[0].t, period.start);
Expand Down

0 comments on commit 1815117

Please sign in to comment.