-
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
m3u8-parser: fill missing rendition report attrs #5110
Conversation
6303a94
to
9fade08
Compare
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.
Have you looked at switchParams
in base-stream-controller?
Parsed attributes should reflect what was parsed from the playlist. If using the current level details is allowed when these attributes are missing then this can be handled in switchParams
using previous
details when present:
https://github.com/video-dev/hls.js/blob/v1.2.9/src/controller/base-playlist-controller.ts#L69
- const msn = parseInt(attr['LAST-MSN']);
- let part = parseInt(attr['LAST-PART']);
+ const msn = parseInt(attr['LAST-MSN']) || previous?.lastPartSn;
+ let part = parseInt(attr['LAST-PART']) || previous?.lastPartIndex;
9fade08
to
1665b1c
Compare
Thanks @robwalch, I drafted something that extracts this info in Did you mean that I'll add new fields to LevelDetails to hold this stuff? |
It is doable with the fields that are there. The LL-HLS playlist reload logic already does this around calls to |
eb9cc9c
to
c21cb72
Compare
Thanks Rob! I updated the PR. Btw, in terms of style, my personal preference is always to have flat code, and avoid high levels of indentation. So, in this specific function, I would do something like: |
Why not use the optional operator on previous? it's flatter.
|
according to the hls spec - " A server MAY omit adding an attribute to an EXT-X-RENDITION-REPORT tag - even a mandatory attribute - if its value is the same as that of the Rendition Report of the Media Playlist to which the EXT-X- RENDITION-REPORT tag is being added. Doing so reduces the size of the Rendition Report." this PR fills out any missing LAST-MSN/LAST-PART attributes from rendition reports, by copying the respective values from the current level being parsed.
cabb06a
to
5407a2c
Compare
You're right, when I read your first comment, I thought this was just pseudocode :) sorry about that. Anyway, I removed the |
@robwalch, does this look ok? do you think we can merge it? |
This PR will...
Fill out any missing LAST-MSN/LAST-PART attributes from rendition reports, by copying the respective values from the current level being parsed.
Why is this Pull Request needed?
According to the hls spec -
" A server MAY omit adding an attribute to an EXT-X-RENDITION-REPORT
tag - even a mandatory attribute - if its value is the same as that
of the Rendition Report of the Media Playlist to which the EXT-X-
RENDITION-REPORT tag is being added. Doing so reduces the size of
the Rendition Report."
Are there any points in the code the reviewer needs to double check?
Normally LAST-MSN / LAST-PART are strings, here they are set to an int, from my tests it works just fine, but just a point to keep in mind.
Resolves issues:
Checklist