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

fix: Add exclude reason and skip duplicate playlist-unchanged #1082

Merged
merged 9 commits into from
Mar 5, 2021

Conversation

brandonocasey
Copy link
Contributor

Add a reason for exclusions and skip playlist-unchanged if we have already seen it.

Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be worth a test.

@@ -1066,6 +1075,9 @@ export class MasterPlaylistController extends videojs.EventTarget {

// Blacklist this playlist
currentPlaylist.excludeUntil = Date.now() + (blacklistDuration * 1000);
if (error.reason) {
currentPlaylist.lastExcludeReason = error.reason;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the short term, do you think we should add this as lastExcludeReason_ to prevent others from using it? Or maybe we should decide if it would make sense to have an array of reasons/what we want a public API on playlists should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think making it an underscore works as I think our whole exclusion mechanism needs a rework and I don't want anyone to rely on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, let's keep it private for now. We should think about this more formally for the longer term.

@@ -705,6 +705,9 @@ export default class DashPlaylistLoader extends EventTarget {
}

updateMinimumUpdatePeriodTimeout_() {
if (!this.isMaster_) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only add a minimum update period timer on the master playlist object.

@@ -728,7 +731,7 @@ export default class DashPlaylistLoader extends EventTarget {
// If we haven't yet selected a playlist, wait until then so we know the
// target duration
if (!this.media()) {
this.one('loadedplaylist', () => {
this.one('loadedmetadata', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When media loads on the master playlist for the first time it's called loadedmetadata. loadedplaylist signifies the load of the master playlist.

@@ -791,9 +794,10 @@ export default class DashPlaylistLoader extends EventTarget {
this.trigger('playlistunchanged');
}

if (!this.media().endList) {
if (!this.media().endList && !this.mediaUpdateTimeout) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only have one mediaupdatetimeout running at a time for an object. Mutex's ftw

gkatsev
gkatsev previously approved these changes Mar 1, 2021
Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'll defer to @gesinger

src/dash-playlist-loader.js Outdated Show resolved Hide resolved
}
}

// if minimumUpdatePeriod is invalid or <= zero skip creating a timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what cases can this happen? Removed to become a VOD?

It might be worth some log messages here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm honestly not sure, that's just what the original code assumed. I would think that it is removed as the source becomes a VOD, and I will clarify that in the comment.

src/dash-playlist-loader.js Outdated Show resolved Hide resolved
// ignore unchanged playlists that have already been
// excluded for not-changing. We likely just have a really slowly updating
// playlist.
if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it also worth checking the last excludeUntil date to see if we're passed the point where the exclusion should be considered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻 It might be but I think that playlist-unchanged excludes are not likely to stop happening no matter how much time has passed.

Comment on lines +751 to +753
// if minimumUpdatePeriod is invalid or <= zero, which
// can happen when a live video becomes VOD. skip timeout
// creation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the DASH Interop as a reference:

https://dashif.org/docs/DASH-IF-IOP-v4.2-clean.htm

4.6.4.             Transition Phase between Live and On-Demand

In the scenario for which the same MPD URL is used for live and On-Demand content, once the URL and publish time of the last Segment is known for the live service, and the duration of the service is known as well, the service provider acts as defined in clause 4.4.3.1, i.e.,

-          adds the attribute MPD@mediaPresentationDuration
-          removes the attribute MPD@minimumUpdatePeriod

If the value is < 0 we should probably issue a warning, as I don't think that should be valid.

src/dash-playlist-loader.js Show resolved Hide resolved
@@ -752,6 +754,9 @@ export default class DashPlaylistLoader extends EventTarget {
// can happen when a live video becomes VOD. skip timeout
// creation.
if (typeof mup !== 'number' || mup <= 0) {
if (mup < 0) {
this.logger_('minimumUpdatePeriod is less then 0 and invalid');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        this.logger_(`found invalid minimumUpdatePeriod of ${mup}, not setting a timeout`);

@gkatsev
Copy link
Member

gkatsev commented Mar 5, 2021

Ran a live stream for ~20 minutes and it's working fine.

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