Uri resolution - #3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the media-playlist parsing flow to ensure segment URI lines are associated with the correct segment-defining tag (#EXTINF / #EXT-X-BYTERANGE) even when non-segment tags (like #EXT-X-PROGRAM-DATE-TIME) appear in between, and adds regression tests/fixtures for those layouts.
Changes:
- Track a “pending segment URI target” tag in
PlaylistParserso intervening tags don’t accidentally capture segment URIs. - Add JUnit coverage for PDT-before-
#EXTINFand PDT-between-#EXTINF-and-URI playlist layouts. - Add new test playlist resource fixtures for the above scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/com/comcast/viper/hlsparserj/PlaylistParser.java | Tracks a pending segment tag (EXTINF / EXT-X-BYTERANGE) to receive the next URI line. |
| src/test/java/com/comcast/viper/hlsparserj/MediaPlaylistPdtTest.java | New tests verifying segment URI association in PDT-adjacent layouts. |
| src/test/resources/mediaplaylist-pdt-between-extinf-and-uri.m3u8 | Fixture where PDT appears between #EXTINF and the URI line. |
| src/test/resources/mediaplaylist-pdt-before-extinf.m3u8 | Fixture where PDT appears before #EXTINF. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request improves the handling of HLS media playlists, specifically around associating segment URIs and program date/time tags, and ensures parser state is correctly reset between parses. It also adds comprehensive tests for these scenarios.
Improvements to segment URI and program date/time handling:
The parser now correctly associates segment URIs with the appropriate preceding tag (
EXTINForEXT-X-BYTERANGE), even when tags likeEXT-X-PROGRAM-DATE-TIMEappear between the segment info and the URI. This fixes edge cases where the program date/time tag is placed between#EXTINFand the segment URI, ensuring accurate mapping of date/time to segments. [1] [2]The logic for setting the program date/time on segments has been enhanced: if a
#EXT-X-PROGRAM-DATE-TIMEtag appears after a segment tag but before the URI, it is now correctly associated with that segment.Parser state management:
Robustness improvements:
Testing:
MediaPlaylistPdtTestandPlaylistParserTestto verify correct segment URI and program date/time association, parser state reset between parses, and handling of whitespace. [1] [2]