-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Retry aligning audio playlist with main playlist if levelloaded came too early #4600
Retry aligning audio playlist with main playlist if levelloaded came too early #4600
Conversation
ee4ff6a
to
c7ca851
Compare
(Rebased against current master, mainly to avoid the X; cf. #4604.) |
Activity. |
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.
Hi @Frenzie,
A simpler solution has been suggested here: #4631 (comment)
Would you be willing to make the changes to adopt this approach?
@robwalch Sure, but unfortunately I won't have time within the next two weeks. |
Hello!! I have a question, what if the bitrate request is still over 100ms? @Frenzie |
@kmikodev If you're talking about this PR in its current form, the 100 ms I mentioned was merely my initial proof of concept that isn't part of the actual diff. I then thought about what would be the best way to do it properly, both in terms of the desired behavior and what would fit in with existing code, and landed on copying base-playlist-controller pretty much verbatim since it does exactly what I wanted. const delay = Math.min(
Math.pow(2, this.retryCount) * config.levelLoadingRetryDelay,
config.levelLoadingMaxRetryTimeout
);
But while I don't have time to investigate right now, it looks like it should suffice to simply trigger the AUDIO_TRACK_LOADED event on level loaded. In theory that's a much simpler and more elegant solution. I'll just need to do extensive testing to verify it indeed works just as well. |
…came too early" This reverts commit b1a2d82.
c7ca851
to
60f363d
Compare
@robwalch Updated as requested. In my testing all seems well. |
Hi @Frenzie, Can you look at the failed unit test? It looks like |
@robwalch This one-line change is all that's needed to pass the test, but I'm not sure if there are any potential pitfalls. |
This will retry aligning the audio playlist with the main playlist if levelloaded came too early
Why is this Pull Request needed?
The problem is that sometimes the onLevelLoaded event comes just after onAudioTrackLoaded, and then everything has to wait around for the entire segment time before it finally gets going.
A very simple workaround looks like this, but that has some rather obvious downsides:
Instead I modeled it on the
levelLoadingRetryDelay
code as in base-playlist-controller which deals with a similar scenario.hls.js/src/controller/base-playlist-controller.ts
Lines 239 to 264 in 5039b23
Are there any points in the code the reviewer needs to double check?
There may be a much better way to do this. In my testing the mistiming only seems to be very slight, so even the default
levelLoadingRetryDelay
of 1000 ms is rather long. 100 ms does the trick without being noticeable.Additionally, whatever the best solution may be, it should presumably be copied more or less verbatim to subtitle-stream-controller. I haven't done testing with that yet, plus as I said I'm not sure if this PR as currently written is necessarily the way to go.
hls.js/src/controller/subtitle-stream-controller.ts
Lines 249 to 252 in 5039b23
Resolves issues:
Fixes #4288.
Checklist