Skip to content

Commit

Permalink
Merge pull request #3011 from Orange-OpenSource/v3-mss-live
Browse files Browse the repository at this point in the history
[MSS] Update for live streams support
  • Loading branch information
epiclabsDASH committed Jun 26, 2019
2 parents ab08f1c + ad7949f commit f0addb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/mss/MssFragmentMoofProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function MssFragmentMoofProcessor(config) {
updateDVR(type, range, streamProcessor.getStreamInfo().manifestInfo);
}

indexHandler.updateSegmentList(representation);
indexHandler.updateRepresentation(representation, true);
}

function updateDVR(type, range, manifestInfo) {
Expand Down
32 changes: 15 additions & 17 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,10 +611,8 @@ function MssParser(config) {
// Duration will be set according to current segment timeline duration (see below)
}

// In case of live streams, set availabilityStartTime property according to DVRWindowLength
if (manifest.type === 'dynamic' && manifest.timeShiftBufferDepth < Infinity) {
manifest.availabilityStartTime = new Date(manifestLoadedTime.getTime() - (manifest.timeShiftBufferDepth * 1000));
manifest.refreshManifestOnSwitchTrack = true;
manifest.refreshManifestOnSwitchTrack = true; // Refresh manifest when switching tracks
manifest.doNotUpdateDVRWindowOnBufferUpdated = true; // DVRWindow is update by MssFragmentMoofPocessor based on tfrf boxes
manifest.ignorePostponeTimePeriod = true; // Never update manifest
}
Expand Down Expand Up @@ -669,22 +667,22 @@ function MssParser(config) {
adaptations[i].ContentProtection_asArray = manifest.ContentProtection_asArray;
}

// Set minBufferTime
if (adaptations[i].contentType === 'video') {
// Set minBufferTime
manifest.minBufferTime = adaptations[i].SegmentTemplate.SegmentTimeline.S_asArray[0].d / adaptations[i].SegmentTemplate.timescale * 2;
}

if (manifest.type === 'dynamic') {
// Set availabilityStartTime for infinite DVR Window from segment timeline duration
if (manifest.timeShiftBufferDepth === Infinity) {
manifest.availabilityStartTime = new Date(manifestLoadedTime.getTime() - (adaptations[i].SegmentTemplate.SegmentTimeline.duration * 1000));
}
// Match timeShiftBufferDepth to video segment timeline duration
if (manifest.timeShiftBufferDepth > 0 &&
manifest.timeShiftBufferDepth !== Infinity &&
adaptations[i].contentType === 'video' &&
manifest.timeShiftBufferDepth > adaptations[i].SegmentTemplate.SegmentTimeline.duration) {
manifest.timeShiftBufferDepth = adaptations[i].SegmentTemplate.SegmentTimeline.duration;
if (manifest.type === 'dynamic' ) {
// Set availabilityStartTime
segments = adaptations[i].SegmentTemplate.SegmentTimeline.S_asArray;
let endTime = (segments[segments.length - 1].t + segments[segments.length - 1].d) / adaptations[i].SegmentTemplate.timescale * 1000;
manifest.availabilityStartTime = new Date(manifestLoadedTime.getTime() - endTime);

// Match timeShiftBufferDepth to video segment timeline duration
if (manifest.timeShiftBufferDepth > 0 &&
manifest.timeShiftBufferDepth !== Infinity &&
manifest.timeShiftBufferDepth > adaptations[i].SegmentTemplate.SegmentTimeline.duration) {
manifest.timeShiftBufferDepth = adaptations[i].SegmentTemplate.SegmentTimeline.duration;
}
}
}
}
Expand Down Expand Up @@ -742,7 +740,7 @@ function MssParser(config) {
}

// Floor the duration to get around precision differences between segments timestamps and MSE buffer timestamps
// and the avoid 'ended' event not being raised
// and then avoid 'ended' event not being raised
manifest.mediaPresentationDuration = Math.floor(manifest.mediaPresentationDuration * 1000) / 1000;
period.duration = manifest.mediaPresentationDuration;

Expand Down

0 comments on commit f0addb3

Please sign in to comment.