-
Notifications
You must be signed in to change notification settings - Fork 136
Fix getPeriodForTime util
#1738
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
Conversation
An issue, #1736, noticed that we have an issue with the `getPeriodForTime` util which links time and Period. The way the util was written means it had to be looped over from the last to the first, but I don't know why I decided to replace it with a fancier `for...of` (which goes from first to last) in a totally unrelated refacto (#1507). This broke the logic and lead in conditions that are hard to predict infinite rebuffering issues. I also made some other code more resilient here, because I thought that I saw another issue first. I don't really know if that other case is possible but I thought that it didn't cost anything to be resilient there.
| // Last check just for resilience reasons that the wanted Period is | ||
| // not one of the already-handled ones | ||
| return; | ||
| } |
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.
NOTE: This was the part just for resilience, as I was under the impression that the edge case of:
timeis exactly at a Period's end- next Period is later (there's a discontinuity currently)
Was not properly considered here, but I never reproduced an issue with it.
Only risk that I can think of from that update is that we now compute nextPeriod before the periodStreamCleared() callback and currentCanceller.cancel() both which may perform unknown side-effects.
We could also just re-compute nextPeriod there - at the expense of code readability - as you wish.
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.
I finally chose to just re-compute it.
|
✅ Automated performance checks have passed on commit DetailsPerformance tests 1st run outputNo significative change in performance for tests:
|
An issue, #1736, noticed that we have a problem with the
getPeriodForTimeutil which links the current playback timestamp and the Period to which it is associated to.The way the util was written means it had to be looped over from the last to the first, but I don't know why I decided to replace it with a fancier
for...of(which goes from first to last) in a totally unrelated refacto (#1507).This broke the logic and lead, with conditions that are hard to predict, to some infinite rebuffering issues.
I also made some other code more resilient here, because I thought that I saw another issue first. I don't really know if that other case is possible but I thought that it didn't cost anything to be resilient there.