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

fix: missing CMCD params in some http requests #5072

Merged
merged 53 commits into from
Mar 15, 2023

Conversation

littlespex
Copy link
Contributor

Resolves #5067

dsparacio and others added 30 commits October 29, 2020 16:06
lib/player.js Outdated Show resolved Hide resolved
this.apply_(request);
};

playerInterface.getNetworkingEngine()
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach has the problem that there is a publicly exported networkingEngine.clearAllRequestFilters method. If a user calls that method, expecting to remove the request filters they had added, it would be bad if it also removed our internal request filters. We haven't used request or response filters internally before this point for that reason.

We make a new CMCD manager (and this a new cmcd header filter) for each asset loaded, so I don't think it would be a common problem, but it could be an issue if someone unloads their request filters mid-playback.

One alternative I can think of (going by your rationale for this design with your comment to Joey, above, to avoid linking the two classes too tightly)...
You could add a separate array of internal-only request filters, which are used in the same way as other request filters but have a non-public register and unregister method.

Copy link
Member

Choose a reason for hiding this comment

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

Separate internally-registered filters seems reasonable to me, assuming it's not too complex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored the CmcdManager and NetworkingEngine.prototype.request to pass and optional context to the request call. With this info, CMCD params can be calculated directly as a RequestFilter. Additionally an onRequest handler has been added to the NetworkingEngine constructor which acts as a non-clearable request filter.

Copy link
Contributor

@theodab theodab left a comment

Choose a reason for hiding this comment

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

Overall this new approach looks pretty good.
I like how it ended up moving some CMCD-specific logic out of the streaming engine and into the CMCD manager, that was nice.
I just have a few quibbles, mostly style-related.

externs/shaka/net.js Outdated Show resolved Hide resolved
lib/dash/dash_parser.js Outdated Show resolved Hide resolved
lib/dash/dash_parser.js Outdated Show resolved Hide resolved
lib/util/cmcd_manager.js Show resolved Hide resolved
lib/util/cmcd_manager.js Show resolved Hide resolved
@avelad
Copy link
Member

avelad commented Mar 15, 2023

Another thing is that the title is no longer correct, since it resolves #5067 and #5094

@littlespex littlespex changed the title fix: missing CMCD params in HEAD requests fix: missing CMCD params in player requests Mar 15, 2023
@littlespex littlespex changed the title fix: missing CMCD params in player requests fix: missing CMCD params in some http requests Mar 15, 2023
@littlespex littlespex requested a review from avelad March 15, 2023 06:59
@theodab theodab dismissed joeyparrish’s stale review March 15, 2023 09:08

Joey's requested changes have been fulfilled.

@theodab theodab merged commit fe38e45 into shaka-project:main Mar 15, 2023
@littlespex littlespex deleted the issue/5067-CMCD-HEAD branch March 23, 2023 17:46
@joeyparrish
Copy link
Member

This doesn't cherry-pick cleanly to v4.3.x, so it will be out in v4.4.0.

@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
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMCD data is not sent on some requests when there is no extension in the URL
5 participants