Skip to content

Commit

Permalink
Fix multiperiod playback
Browse files Browse the repository at this point in the history
Lookup times when transitioning from one Period to another, need to be
relative to the presentation, not the next period.

I'm not sure when this broke.

Relates to #310

Change-Id: I6e3f94bb9c6aad8c8f3ef73e73b0073e015f796e
  • Loading branch information
joeyparrish committed Mar 21, 2016
1 parent 5f46cf7 commit 6f1d769
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,11 @@ shaka.media.StreamingEngine.prototype.getSegmentReference_ = function(
} else {
// Something is buffered from another Period.
shaka.log.v1(logPrefix, 'next position unknown: another Period buffered');
var lastPeriodStart =
this.manifest_.periods[mediaState.lastSegmentPeriodIndex].startTime;
position = this.lookupSegmentPosition_(
mediaState,
mediaState.lastSegmentReference.endTime,
lastPeriodStart + mediaState.lastSegmentReference.endTime,
currentPeriodIndex);
}
}
Expand All @@ -1006,7 +1008,7 @@ shaka.media.StreamingEngine.prototype.getSegmentReference_ = function(
* Looks up the position of the next segment needed.
*
* @param {shaka.media.StreamingEngine.MediaState_} mediaState
* @param {number} time
* @param {number} time relative to presentation timeline
* @param {number} currentPeriodIndex
* @return {number}
* @throws {!shaka.util.Error} If the next segment does not exist.
Expand All @@ -1029,6 +1031,7 @@ shaka.media.StreamingEngine.prototype.lookupSegmentPosition_ = function(
if (position == null) {
shaka.log.warning(logPrefix,
'next segment does not exist:',
'lookupTime=' + lookupTime,
'time=' + time,
'currentPeriod.startTime=' + currentPeriod.startTime,
'mediaState.drift=' + mediaState.drift);
Expand Down

0 comments on commit 6f1d769

Please sign in to comment.