-
Notifications
You must be signed in to change notification settings - Fork 475
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
Rework segment.key as segment.keys, a list of keys #313
base: master
Are you sure you want to change the base?
Conversation
This closes globocom#283 as it now follows RFC and keeps all preceding keys for the segment. - `m3u8_obj.keys` still has the same behaviour. - `m3u8_obj.segments[0].key` is now removed. - `m3u8_obj.segments[0].keys` is added in it's place, which will now always be a list. - The list will always be present, it will never be `None` anymore, and if the segment explicitly has no DRM by specifying an EXT-X-KEY of METHOD=NONE then it will be a list with that key. - It does not check if there's a METHOD=NONE with other conflicting EXT-X-KEY information. - It still follows the same behaviour of not duplicating the EXT-X-KEY information on future segments when dumping. Do note that it only clears the list of Keys when it reaches an EXT-X-DISCONTINUITY, or it has reached a ts segment. The copy() statement is used because it clears after the segment is appended to `data`, yet the .clear() to `current_keys` follows in the appended `segment` unless we copy that data in memory prior. I don't think there's a need for `.by_key()` or `m3u8_obj.keys` anymore, but I've made sure those still work as intended in case there's a different reason those exist.
Hey @rlaphoenix sorry for the late reply. I will review it this weekend |
Ok great. One thing I have thought of is we could keep compatibility by re-adding back |
@rlaphoenix good job! About implementing backwards compatibility, I think we can upgrade the major version of |
@rlaphoenix it looks like the test suite failed. Can you check it? |
973ce64
to
e5ed623
Compare
This keeps compatibility and fixes a lot of the existing tests. However, new tests should likely be implemented for testing HLS playlists with multiple preceeding keys.
e5ed623
to
69fa67e
Compare
Hi, apologies for all the squashes, but I believe it has the tests fixed. I have re-implemented Also, the tests on Windows causes it to compare e.g.,
Half of those failures seem to be Windows-specific, and not really an issue in practice. Here are logs of the other 5 errors in top to bottom order:
Doesn't seem to be caused by my changes. At least not directly. The behavior seen here seems correct and keys should be a length of 2.
Seems like this may or may not be a windows thing, I'm not entirely sure what this is really checking.
Like the first error log above, seems like it's testing the same, but with more variance of keys, therefore I still think it's not caused by my changes.
This has actually failed, because The best we could do is instead of using by_key(None), we could loop all segments and if I think overall, behavior relating to We would need to decide to keep key and by_key for now, fixing the tests and adding some changes, or ditch both key and by_key, as well as the tests for them, then make new tests for |
This is because the segment may be constructed with both `key` and `keyobject` due to `Segment(..., **segment)` being done. Even though we do not use the `key` argument, we must define it.
This code assumes that the key carries forward to the next segments, which even before my changes I don't believe it would. Either way it definitely doesn't now, and this would be correct behaviour.
@rlaphoenix If I understood it right, your code is backwards compatible right? Maybe in a major update release we can remove the |
Correct. Pulling this as it is right now might not be the best idea. As stated before there's no real tests made for It's sort of up to you what you want to do. We could just drop One thing I will say is that I use these current changes in another project (before the squashes/changes to add back To be clear, the only issues right now seem to be fixing/adding tests to reflect the new |
Is there anything still blocking this PR? This would be a very welcome update. |
To be honest, there's been no advancements since the last comment I made. Basically, what was said in that comment still applies. |
what is happening with that? |
This closes #283 as it now follows RFC and keeps all preceding keys for the segment.
m3u8_obj.keys
still has the same behaviour.m3u8_obj.segments[0].key
is now removed.m3u8_obj.segments[0].keys
is added in it's place, which will now always be a list.None
anymore, and if the segment explicitly has no DRM by specifying an EXT-X-KEY of METHOD=NONE then it will be a list with that key.Do note that it only clears the list of Keys when it reaches an EXT-X-DISCONTINUITY, or it has reached a ts segment.
The copy() statement is used because it clears after the segment is appended to
data
, yet the .clear() tocurrent_keys
follows in the appendedsegment
unless we copy that data in memory prior.I don't think there's a need for
.by_key()
orm3u8_obj.keys
anymore, but I've made sure those still work as intended in case there's a different reason those exist.P.S., The
by_key
function does not work to match a key to a segment, therefore it's more or less useless. Similarly, the m3u8keys
list was on the right track but is ultimately useless as we cannot calculate which of the keys are for a segment. You cannot assume keys[0] is for segments[0].The approach seen in this pull request is the only viable option to truly match EXT-X-KEYs to a segment when there are multiple preceding keys.