-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: suggestedPresentationDelay #698
Conversation
src/master-playlist-controller.js
Outdated
@@ -925,6 +925,7 @@ export class MasterPlaylistController extends videojs.EventTarget { | |||
} | |||
|
|||
let media = this.masterPlaylistLoader_.media(); | |||
const suggestedPresentationDelay = this.masterPlaylistLoader_.master.suggestedPresentationDelay |
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.
Minor, but might be better to move this closer to where it's used.
src/playlist.js
Outdated
if (!playlist.segments.length) { | ||
return 0; | ||
} | ||
|
||
let i = playlist.segments.length - 1; | ||
let distanceFromEnd = playlist.segments[i].duration || playlist.targetDuration; | ||
const safeDistance = distanceFromEnd + playlist.targetDuration * 2; | ||
const safeDistance = liveEdgePadding || (distanceFromEnd + playlist.targetDuration * 2); |
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.
What if someone wants to explicitly put 0
in the MPD for suggestedPresentationDelay? (IOP recommends it be at least minBufferTime
, but nothing in spec prevents it from being set to 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.
Yup, that should be valid. I guess that's why having some tests added would be good.
@@ -1973,6 +1974,7 @@ function(assert) { | |||
Playlist.seekable = () => { | |||
return videojs.createTimeRanges(mainTimeRanges); | |||
}; | |||
this.masterPlaylistController.masterPlaylistLoader_.master = media; |
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.
Not a big deal, but may be worth adding a comment saying it's just a placeholder, or putting in a different value, since the master should always reference either a master playlist object or a skeleton of one created to wrap around a media playlist.
let lastSegmentDuration = playlist.segments[i - 1].duration || playlist.targetDuration; | ||
const safeDistance = typeof liveEdgePadding === 'number' ? liveEdgePadding : lastSegmentDuration + playlist.targetDuration * 2; | ||
|
||
if (safeDistance === 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.
Do we want this to account for any distance less than last segment duration?
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.
no, I think we should only special-case 0 exactly. Any other value should be ran through the loop below to find the appropriate return value.
This reverts commit 70a4c40.
This is a port of #698 against master.
This is a port of #698 against master.
This is a port of #698 against master.
This is a port of #698 against master.
This is a port of #698 against master.
Use the suggestedPresentation delay when available instead of calculating it like it is done in HLS.
Depends on videojs/mpd-parser#82