Skip to content
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

Add variable substitution support to HLS parser #2509

Merged
merged 7 commits into from
Apr 24, 2020

Conversation

avelad
Copy link
Member

@avelad avelad commented Apr 17, 2020

Resolves #1561

Copy link
Member

@joeyparrish joeyparrish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great for the most part. Thanks!

if (replaceValue) {
newUri = newUri.replace(variable, replaceValue);
} else {
shaka.log.error(uriVariables, variableName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some text to this log? Without context, it's a bid odd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added more information to the log.

@@ -650,6 +650,11 @@ shaka.util.Error.Code = {
*/
'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,

/**
* The HLS manifest requires undeclared variables.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "refers to" instead of "requires". I think that might be clearer.

It might also be good to add the variable name to the error using the "data" array. Just add additional parameters to the new shaka.util.Error() call and document them here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added that when the error is launched also include the missing varibale.

goog.asserts.assert(
audioPosition != null, 'Cannot find first audio segment');

const videoReference = video.segmentIndex.get(videoPosition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we refactored the manifest in #1339, SegmentIndex now implements Iterable, so you can now do things like this:

const videoReference = Array.from(video.segmentIndex)[0]

And not worry about positions and null checks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the tests to use this new mechanism. Thank you!

expect(videoReference).not.toBe(null);
expect(audioReference).not.toBe(null);
if (videoReference) {
expect(videoReference.getUris())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why you check the URIs of the segments, when the test only has variables in the playlist URIs. Could you add comments?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a comment that explains the need for this.

@avelad
Copy link
Member Author

avelad commented Apr 23, 2020

I will review all your comments tomorrow. Thank you!

Copy link
Member

@joeyparrish joeyparrish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@shaka-bot
Copy link
Collaborator

All tests passed!

@joeyparrish joeyparrish merged commit e246855 into shaka-project:master Apr 24, 2020
@avelad avelad deleted the hls-variable-substitution branch April 27, 2020 06:49
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HLS: Support variable substitution
3 participants