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: Restart masterPlaylistLoader after media change #1339

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

alex-barstow
Copy link
Contributor

@alex-barstow alex-barstow commented Oct 20, 2022

Description

Whenever a playlist is excluded for any reason, we pause the masterPlaylistLoader and never restart it. We have noticed this causing timeouts with live DASH playback which relies on regular MPD refreshes.

If, for example, a single MPD or segment request fails for whatever reason, the minimumUpdatePeriod timeout gets cleared permanently, which halts any further MPD refreshes. This is a side-effect of blacklistCurrentPlaylist() , which gets called on all MPL and MSL errors. The MPC eventually picks up on the fact that the MPD is no longer updating and starts a cascade of futile playlist switches which ultimately result in a timeout (futile because the lack of MPD refreshes means none of the playlists are updating).

This may also be causing problems with HLS, although they are less apparent since the media playlist loaders continue fetching media playlists even when the masterPlaylistLoader is paused. I haven't spent much time yet thinking through the implications for HLS-- I'd appreciate some input there.

Tentative Changes Proposed

Other loaders that are paused during the playlist exclusion process (ex. AUDIO, SUBTITLES) get restarted on 'mediachange', so it seems to make sense to do the same for the masterPlaylistLoader.

Note: There was already a bit of discussion on Slack about this and there was some skepticism that this 'mediachange' handler is the best place to put the load() call. I've spent some time investigating better alternatives, but haven't yet come up with anything. I'm leaving this as a draft for now so we can discuss further.

@codecov
Copy link

codecov bot commented Oct 20, 2022

Codecov Report

Merging #1339 (c2681bb) into main (404ba76) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1339   +/-   ##
=======================================
  Coverage   86.32%   86.32%           
=======================================
  Files          39       39           
  Lines        9856     9857    +1     
  Branches     2298     2298           
=======================================
+ Hits         8508     8509    +1     
  Misses       1348     1348           
Impacted Files Coverage Δ
src/master-playlist-controller.js 94.66% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@gkatsev
Copy link
Member

gkatsev commented Oct 20, 2022

We do call load on the main segment loader just below, so, this sounds good to me.

@alex-barstow alex-barstow marked this pull request as ready for review October 27, 2022 14:58
@alex-barstow
Copy link
Contributor Author

@gkatsev @gesinger Mind reviewing now that it's no longer a draft?

@@ -614,6 +614,8 @@ export class MasterPlaylistController extends videojs.EventTarget {
this.requestOptions_.timeout = requestTimeout;
}

this.masterPlaylistLoader_.load();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this happen in the dash/hls playlist loader itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean like add a 'mediachange' listener to the constructor? I think we could. Does the same go for the mainSegmentLoader_ method calls below this? Should they be moved as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

So the master playlist loader fires mediachange. It should probably start to load by itself after that too? Could totally be wrong, as I haven't looked at the code in a bit now. I think having the mainSegmentLoader_ call load here is 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.

4 participants