Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit e6a485a

Browse files
committed
DVRWindow Infinity
1 parent e945bc2 commit e6a485a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

app/js/mss/MssFragmentController.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,20 @@ Mss.dependencies.MssFragmentController = function() {
100100
return;
101101
}
102102
// In case of live streams, update segment timeline according to DVR window
103-
else if ((manifest.timeShiftBufferDepth && manifest.timeShiftBufferDepth > 0) || manifest.canSeek ) {
103+
else if (manifest.timeShiftBufferDepth && manifest.timeShiftBufferDepth > 0) {
104104
// Get timestamp of the last segment
105105
segment = segments[segments.length - 1];
106106
t = segment.t;
107107

108108
// Determine the segments' availability start time
109109
availabilityStartTime = t - (manifest.timeShiftBufferDepth * timescale);
110110

111-
if (manifest.timeShiftBufferDepth > 0) {
112-
// Remove segments prior to availability start time
111+
// Remove segments prior to availability start time
112+
segment = segments[0];
113+
while (segment.t < availabilityStartTime) {
114+
this.debug.log("[MssFragmentController][" + type + "] Remove segment - t = " + (segment.t / timescale));
115+
segments.splice(0, 1);
113116
segment = segments[0];
114-
while (segment.t < availabilityStartTime) {
115-
this.debug.log("[MssFragmentController][" + type + "] Remove segment - t = " + (segment.t / timescale));
116-
segments.splice(0, 1);
117-
segment = segments[0];
118-
}
119117
}
120118

121119
// Update DVR window range => set range's end to end time of current segment

app/js/mss/MssParser.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,11 @@ Mss.dependencies.MssParser = function() {
568568
var isLive = this.domParser.getAttributeValue(smoothNode, 'IsLive');
569569
mpd.type = (isLive !== null && isLive.toLowerCase() === 'true') ? 'dynamic' : 'static';
570570
var canSeek = this.domParser.getAttributeValue(smoothNode, 'CanSeek');
571-
mpd.canSeek = (canSeek !== null && canSeek.toLowerCase() === 'true');
572-
mpd.timeShiftBufferDepth = parseFloat(this.domParser.getAttributeValue(smoothNode, 'DVRWindowLength')) / mpd.timescale;
571+
//mpd.canSeek = (canSeek !== null && canSeek.toLowerCase() === 'true');
572+
var dvrWindowLength = parseFloat(this.domParser.getAttributeValue(smoothNode, 'DVRWindowLength'));
573+
if (dvrWindowLength===0 && canSeek !== null && canSeek.toLowerCase() === 'true')
574+
dvrWindowLength = Infinity;
575+
mpd.timeShiftBufferDepth = dvrWindowLength / mpd.timescale;
573576
var duration = parseFloat(this.domParser.getAttributeValue(smoothNode, 'Duration'));
574577

575578
// If live manifest with Duration, we consider it as a start-over manifest
@@ -587,7 +590,7 @@ Mss.dependencies.MssParser = function() {
587590
mpd.minBufferTime = MediaPlayer.dependencies.BufferExtensions.DEFAULT_MIN_BUFFER_TIME;
588591

589592
// In case of live streams, set availabilityStartTime property according to DVRWindowLength
590-
if (mpd.type === "dynamic") {
593+
if (mpd.type === "dynamic" && mpd.timeShiftBufferDepth < Infinity ) {
591594
mpd.availabilityStartTime = new Date(manifestLoadedTime.getTime() - (mpd.timeShiftBufferDepth * 1000));
592595
}
593596

@@ -649,8 +652,12 @@ Mss.dependencies.MssParser = function() {
649652
}
650653

651654
if (mpd.type === "dynamic") {
655+
// set availabilityStartTime for infinite DVR Window from segment timeline duration
656+
if (mpd.timeShiftBufferDepth===Infinity)
657+
mpd.availabilityStartTime = new Date(manifestLoadedTime.getTime() - (adaptations[1].SegmentTemplate.SegmentTimeline.duration * 1000));
652658
// Match timeShiftBufferDepth to video segment timeline duration
653659
if (mpd.timeShiftBufferDepth > 0 &&
660+
mpd.timeShiftBufferDepth !== Infinity &&
654661
adaptations[i].contentType === 'video' &&
655662
mpd.timeShiftBufferDepth > adaptations[i].SegmentTemplate.SegmentTimeline.duration) {
656663
mpd.timeShiftBufferDepth = adaptations[i].SegmentTemplate.SegmentTimeline.duration;

0 commit comments

Comments
 (0)