-
Notifications
You must be signed in to change notification settings - Fork 429
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: Update minimumUpdatePeriod handling #942
Conversation
src/dash-playlist-loader.js
Outdated
@@ -766,10 +764,11 @@ export default class DashPlaylistLoader extends EventTarget { | |||
|
|||
// Clear & reset timeout with new minimumUpdatePeriod |
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.
It may be worth creating a updateMinimumUpdatePeriodTimeout_()
function to centralize the logic of the three uses (even can include the clearing) and add a comment around why we use the target duration when the minimumUpdatePeriod is 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 makes sense. Done
if (minimumUpdatePeriod >= 0) { | ||
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => { | ||
this.trigger('minimumUpdatePeriod'); | ||
}, minimumUpdatePeriod || this.media().targetDuration * 1000); |
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.
We should add a comment here saying why the default is target duration.
@@ -646,6 +650,16 @@ export default class DashPlaylistLoader extends EventTarget { | |||
} | |||
} | |||
|
|||
updateMinimumUpdatePeriodTimeout_() { |
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.
It would also make sense to add the clearing of the old one here too.
This fixes a bug caused by an oversight in #942. If the MPD@minimumUpdatePeriod is 0 in the first dynamic MPD we load, we should use the media's target duration as the MPD refresh interval, however we need to wait until a playlist has been selected before we can know DashPlaylistLoader.media().targetDuration, otherwise we get a TypeError.
Description
This is part of a set of upcoming changes to add support for live DASH playback. Specifically, this PR differentiates the handling of 2 cases which were formerly conflated:
MPD@minimumUpdatePeriod
attribute has a value of 0, indicating that the MPD has no validity after the moment it was retrieved.MPD@minimumUpdatePeriod
attribute is absent, indicating the MPD has infinite validity and will never be updatedSpecific Changes proposed
mpd-parser
to allow us to identify case 2updateMaster()
checks if a manifest'sminimumUpdatePeriod
value changes, and return the new manifest if so.targetDuration
, per existingTODO
'minimumUpdatePeriod'
event as there is no need to refresh the manifest