-
Notifications
You must be signed in to change notification settings - Fork 795
use specified mediasequence for VOD expired sync instead of assuming 0 #1097
Conversation
A test we should check for: if a live stream ends, and we switch to a playlist that we haven't seen before (don't have |
That scenario is definitely a problem, but it is not a very common case. I think it will be ok to move forward with this and make an issue for that case to address in another PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have some tests for getExpiredTime for VOD.
src/sync-controller.js
Outdated
// If the sync-point is beyond the start of the playlist, we want to subtract the | ||
// duration from index 0 to syncPoint.segmentIndex instead of adding. | ||
if (syncPoint.segmentIndex > 0) { | ||
syncPoint.time = -1 * syncPoint.time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just do syncPoint.time *= -1
src/sync-controller.js
Outdated
|
||
/** | ||
* Runs each sync-point strategy and returns a list of sync-points returned by the | ||
* stratigies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strategies
src/sync-controller.js
Outdated
* @param {Playlist} playlist | ||
* Playlist object to calculate expired from | ||
* @param {Number} duration | ||
* Duration of the MediaSource (Infinite if playling a live source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use Infinity
?
src/sync-controller.js
Outdated
return null; | ||
} | ||
|
||
const syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long line
src/sync-controller.js
Outdated
* | ||
* @private | ||
* @param {Playlist} playlist - The playlist that needs a sync-point | ||
* @param {Number} duration - Duration of the MediaSource (Infinite if playing a live source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also use Infinity
here?
src/sync-controller.js
Outdated
* @param {Number} target.value | ||
* The value to target for the specified key. | ||
* @returns {Object} | ||
* The sync-poiont nearest the target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point
test/sync-controller.test.js
Outdated
|
||
let expired = this.syncController.getExpiredTime(playlist, Infinity); | ||
|
||
assert.equal(expired, 100, 'seekable range calculated'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion would probably be clearer using your below format. Something like estimated expired time using sync info
test/sync-controller.test.js
Outdated
|
||
expired = this.syncController.getExpiredTime(playlist, Infinity); | ||
|
||
assert.equal(expired, 98.5, 'estimated start time using segmentSync'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to use estimated expired time...
instead of start for these and others
Tested and LGTM |
Description
Seekable calculations assumed that VOD playlists have an
EXT-X-MEDIA-SEQUENCE
of0
, however this is not always the case.This fixes the calculations to use the media sequence specified in the playlistThis has been updated to now use theSyncController
to pick a sync point and calculate expired time