Skip to content

Commit

Permalink
Only use mediaPresentationDuration to detect IPR.
Browse files Browse the repository at this point in the history
We shouldn't use the sum of Period durations to detect the duration of
live streams.  It is possible for Periods to be added or the duration
to change, so the sum of Period durations is only valid for VOD.

Closes #1148

Change-Id: I53846807d18b97b0127eb75bb83be526eb7095ee
  • Loading branch information
TheModMaker committed Nov 22, 2017
1 parent e8087dc commit f0c8509
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,10 @@ shaka.dash.DashParser.prototype.processManifest_ =
var periods = periodsAndDuration.periods;

presentationTimeline.setStatic(mpdType == 'static');
presentationTimeline.setDuration(duration || Infinity);
if (mpdType == 'static' || !periodsAndDuration.durationDerivedFromPeriods) {
// Ignore duration calculated from Period lengths if this is dynamic.
presentationTimeline.setDuration(duration || Infinity);
}
presentationTimeline.setSegmentAvailabilityDuration(
segmentAvailabilityDuration != null ?
segmentAvailabilityDuration :
Expand Down Expand Up @@ -570,7 +573,11 @@ shaka.dash.DashParser.prototype.processManifest_ =
* @param {shaka.dash.DashParser.Context} context
* @param {!Array.<string>} baseUris
* @param {!Element} mpd
* @return {{periods: !Array.<shakaExtern.Period>, duration: ?number}}
* @return {{
* periods: !Array.<shakaExtern.Period>,
* duration: ?number,
* durationDerivedFromPeriods: boolean
* }}
* @private
*/
shaka.dash.DashParser.prototype.parsePeriods_ = function(
Expand Down Expand Up @@ -676,12 +683,14 @@ shaka.dash.DashParser.prototype.parsePeriods_ = function(
}
return {
periods: periods,
duration: presentationDuration
duration: presentationDuration,
durationDerivedFromPeriods: false
};
} else {
return {
periods: periods,
duration: prevEnd
duration: prevEnd,
durationDerivedFromPeriods: true
};
}
};
Expand Down

0 comments on commit f0c8509

Please sign in to comment.