-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(HLS): Skip EXT-X-PRELOAD-HINT without full byterange info #5294
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,7 +158,13 @@ shaka.hls.ManifestTextParser = class { | |
partialSegmentTags.push(tag); | ||
} else if (tag.name == 'EXT-X-PRELOAD-HINT') { | ||
if (tag.getAttributeValue('TYPE') == 'PART') { | ||
partialSegmentTags.push(tag); | ||
if (tag.getAttributeValue('BYTERANGE-START') != null) { | ||
if (tag.getAttributeValue('BYTERANGE-LENGTH') != null) { | ||
partialSegmentTags.push(tag); | ||
} | ||
} else { | ||
partialSegmentTags.push(tag); | ||
} | ||
Comment on lines
+163
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to go straight to the recommendation of https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi, do this instead in // A preload hinted partial segment may have byterange length info.
const pByterangeLength = item.getAttributeValue('BYTERANGE-LENGTH');
if (pByterangeLength) {
pEndByte = pStartByte + Number(pByterangeLength) - 1;
}
// *** ADD THIS ***
else if (pStartByte) {
// If we have a non-zero start byte, but no end byte, follow the recommendation of
// https://tinyurl.com/hls-open-byte-range and set the end byte explicitly to a
// large integer.
pEndByte = Number.MAX_SAFE_INTEGER;
} I haven't tested that against the content in #5089. If it doesn't work, we can just ignore the HINT segment instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I have tried and thought about that, but the problem is that it overlaps with the following partial segments and very rare cases occur. That's why I created this solution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in the future we need to rethink the way we work with byterange, but this is a easy-fix in the meantime. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does MAX_SAFE_INTEGER on preload hint interact poorly with partial segments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a certain segment it has 2 partial segments and 1 preload. In the next update you have 3 partial segments and 1 preload. The preload from before the update has now been converted to a partial segment with all the byterange info, but the new preload doesn't have the info. If we call the first one with the maximum range, we are actually obtaining the corresponding partial and all the following ones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. It seems that Will Law's article suggests getting and using that continuation on purpose, but Shaka Player isn't built for it at the moment. |
||
} else if (tag.getAttributeValue('TYPE') == 'MAP') { | ||
// Rename the Preload Hint tag to be a Map tag. | ||
tag.setName('EXT-X-MAP'); | ||
|
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.
Please add a comment here that BYTERANGE-START without BYTERANGE-LENGTH is being ignored.
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.
Done!