Skip to content
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

Merged
merged 5 commits into from
Sep 23, 2020

Conversation

alex-barstow
Copy link
Contributor

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:

  1. The MPD@minimumUpdatePeriod attribute has a value of 0, indicating that the MPD has no validity after the moment it was retrieved.
  2. The MPD@minimumUpdatePeriod attribute is absent, indicating the MPD has infinite validity and will never be updated

Specific Changes proposed

  • Update mpd-parser to allow us to identify case 2
  • Make sure updateMaster() checks if a manifest's minimumUpdatePeriod value changes, and return the new manifest if so.
  • Add handling for case 1: minimumUpdateperiod is 0
    • Continue refreshing manifests every targetDuration, per existing TODO
  • Add handling for case 2: minimumUpdatePeriod is absent
    • Do not trigger a 'minimumUpdatePeriod' event as there is no need to refresh the manifest
  • Add/update tests

gkatsev
gkatsev previously approved these changes Sep 10, 2020
@@ -766,10 +764,11 @@ export default class DashPlaylistLoader extends EventTarget {

// Clear & reset timeout with new minimumUpdatePeriod
Copy link
Contributor

@gesinger gesinger Sep 10, 2020

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.

Copy link
Contributor Author

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);
Copy link
Contributor

@gesinger gesinger Sep 14, 2020

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_() {
Copy link
Contributor

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.

@gkatsev gkatsev merged commit 8648e76 into main Sep 23, 2020
@gkatsev gkatsev deleted the update-minimumUpdatePeriod-handling branch September 23, 2020 20:48
gkatsev pushed a commit that referenced this pull request Sep 24, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants