fix: remove duplicate representation entries for absolute BaseURLs - #191
Open
cpruijsen wants to merge 1 commit into
Open
fix: remove duplicate representation entries for absolute BaseURLs#191cpruijsen wants to merge 1 commit into
cpruijsen wants to merge 1 commit into
Conversation
When a child BaseURL is absolute, resolving it against every parent BaseURL repeats the same URL. Dedupe the cartesian product by exact object identity so content-steering copies that differ by serviceLocation stay distinct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
buildBaseUrlsdedupes the cartesian product by exact object identity (first copy wins). When an MPD has more than one parentBaseURL(CDN / content steering) and a childBaseURLis absolute, that child is no longer emitted once per parent, sorepresentationInfodoes not contain duplicate playlist entries. Fixes #175.resolveUrlreturns a scheme-bearing URL unchanged, so the product is N identical objects. ParentserviceLocationis not copied in that case, so the copies are exact duplicates.Relative parent×child combinations are unchanged. Content-steering copies that differ by
serviceLocation(or any other attribute) are kept.The TODO that used to sit on
inheritAttributesdescribed these duplicates. On PR #17, mjneil described the same cartesian product: the subtitle representation is duplicated because the absolute child is resolved against each parent BaseURL; the fix belongs in base URL creation.Decision
Drop exact-duplicate resolved BaseURL objects in
buildBaseUrls.Alternative: skip the product only when the child URL did not resolve (
resolvedUrl === childUrl), or unique the finalrepresentationInfolist.The product is built in
buildBaseUrls, and exact-object identity is the smallest key that still keeps distinctserviceLocationcopies. Open to uniquing later or special-casing only absolute URLs.Identity is
JSON.stringifyof the resolved object. Objects are always built asmerge(parseAttributes(el), { baseUrl })plus an optionalserviceLocationassignment, so key order is stable for cartesian clones. Two identical<BaseURL>nodes written in the MPD (not a cartesian artifact) also collapse; copies that differ by any attribute do not.Example
representationInfoforenis one entry (https://example.com/en.vtt), not two. Video representations still have one playlist per CDN.