Repository navigation
Conversation
Two filters run over the rendition lists in ParseMultivariantPlaylist, and between them they can discard every rendition for one uri. m_isUriDuplicate is decided while parsing, first occurrence wins, and cannot consider variant references because EXT-X-MEDIA may precede EXT-X-STREAM-INF. The orphan check added in 913cf7c then drops any rendition no variant references. When two groups share a uri and the orphan is listed first, the referenced rendition is dropped as a duplicate and the orphan is dropped as an orphan, so the period gets no audio adaptation set. AddIncludedAudioStream does not compensate because m_groupIdAudio is not empty. The shape needs only one audio group per video codec family pointing at a single audio playlist - what the existing comment above the audio loop refers to - with one family's variants left unpublished. There is no error: the skip is logged at LOGWARNING and the stream plays without audio. Compute the flag once, after parsing, letting a referenced rendition claim its uri ahead of an orphan, and drop the parse-time marking so there is a single writer. That removes the ordering dependency rather than compensating for it; the parse-time comparison also used the raw URI attribute, so "audio/en.m3u8" and "./audio/en.m3u8" counted as different uris. Behaviour is unchanged whenever no uri is shared, and one surviving rendition per uri across both lists is preserved. Where an audio and a subtitle rendition share a uri the survivor can differ from before - audio now wins rather than whichever came first in the playlist - which only arises on a manifest that is malformed either way. The subtitle loop had the same problem and is covered by the same change.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe HLS parser now de-duplicates rendition URIs after parsing. It processes renditions referenced by variants before orphan renditions. A test covers audio groups that share a URI when the orphan group appears first. ChangesHLS rendition URI de-duplication
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The shared-URI case is covered, and no actionable merge-blocking issue remains after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@gizmocuz the audio stream for group-id 233 should be removed |
|
thanks for the fix! my mistake and unfortunately the AI review that wasnt working |
|
Closing in favour of #2122, which fixes the same bug with less code - caching the I checked it against both cases before saying so: the shared-uri manifest from I have left one note on #2122 - the audio uri goes into the de-duplication set Thanks both. |
Since #2112 /
913cf7c7("[HLSTree] Skip orphan renditions by default") amultivariant playlist can end up with no audio adaptation set, when two
EXT-X-MEDIAgroups share oneURIand the orphaned group is listed first.Two filters run over the rendition lists in
ParseMultivariantPlaylist, and theorder they run in is the problem:
URIhas already been seen is markedm_isUriDuplicate. First occurrence wins, and it cannot take variantreferences into account, because
EXT-X-MEDIAtags may precedeEXT-X-STREAM-INF.FindVariantByAudioGroupIdfindsno variant.
A rendition failing either check is skipped, and nothing reconciles the two, so
both can fire within one
URI.Reproduction
The manifest added in this PR as
src/test/manifests/hls/1a1v_master_orphan_shared_uri.m3u8:group_aud_orphanis parsed first, so it keepsm_isUriDuplicate == false.group_aud_lowhas the sameURIand is marked a duplicate, so it is skipped.group_aud_orphanthen reaches the orphan check: no variant carriesAUDIO="group_aud_orphan", so with the defaulthlsAddOrphansRenditions == falseit is skipped too.The period ends up with no audio adaptation set. Before
913cf7c7,group_aud_orphanwas kept with theFOURCC_MP4Afallback codec and the audioplayed.
AddIncludedAudioStreamdoes not compensate, becausevar.m_groupIdAudiois not empty.Reversing the two
EXT-X-MEDIAlines makes it work, which is what makes this easyto miss.
The subtitle loop has the same shape and is covered by the same change.
Why the shape is not contrived
It is what the comment above the audio loop already refers to - "There may be
multiple renditions with the same uri but different GROUP-ID": one audio group per
video codec family, every group pointing at the same audio playlist. A packager
that publishes only one family's variants, or a manifest filtered per device
profile, leaves the other group orphaned while still listing it.
The failure is also silent - the skip is a
LOGWARNINGand the stream plays,just with no audio.
The change
Compute
m_isUriDuplicateonce, after parsing, letting a referenced renditionclaim a
URIahead of an orphan, and drop the parse-time marking so there is asingle writer. That removes the ordering dependency rather than compensating for
it. The parse-time comparison also used the raw
URIattribute, soaudio/en.m3u8and./audio/en.m3u8counted as different uris - resolutionhappens later, in
PrepareRepresentation.Behaviour is unchanged whenever no
URIis shared, and one surviving renditionper
URIacross the audio and subtitle lists is preserved.One deliberate difference: where an audio and a subtitle rendition share a
URI,the survivor can change - audio now wins, rather than whichever came first in the
playlist. That only arises on a manifest that is malformed either way, and audio
seemed the better thing to keep, but say the word if you would rather preserve
playlist order and I will make the passes follow it.
Tests
Adds
ReferencedRenditionSurvivesSharedUriWithOrphantosrc/test/TestHLSTree.cpp, asserting one audio adaptation set on the manifestabove. Without the change that count is zero, which is the bug.
An alternative approach, if the two-filter arrangement is wanted for other
reasons: keep the parse-time marking but skip it when the
GROUP-IDs differ, andlet
FindMergeablecollapse the adaptation sets later. Happy to redo it that way.Summary by CodeRabbit