Skip to content

Uri resolution - #3

Merged
Baraujo25 merged 9 commits into
masterfrom
URI_RESOLUTION
Jun 3, 2026
Merged

Baraujo25 merged 9 commits into
masterfrom
URI_RESOLUTION

Conversation

@Baraujo25

@Baraujo25 Baraujo25 commented Jun 3, 2026

Copy link
Copy Markdown

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 (EXTINF or EXT-X-BYTERANGE), even when tags like EXT-X-PROGRAM-DATE-TIME appear between the segment info and the URI. This fixes edge cases where the program date/time tag is placed between #EXTINF and 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-TIME tag appears after a segment tag but before the URI, it is now correctly associated with that segment.

Parser state management:

  • The parser's internal state (including tag list and playlist type) is now reset before each parse operation, preventing state leakage when the same parser instance is reused for multiple playlists. [1] [2]

Robustness improvements:

  • The parser now trims whitespace from each line before processing, making it resilient to playlists with irregular formatting.

Testing:

  • Added new unit tests in MediaPlaylistPdtTest and PlaylistParserTest to verify correct segment URI and program date/time association, parser state reset between parses, and handling of whitespace. [1] [2]
  • Added new playlist fixtures to test edge cases with program date/time placement. [1] [2]

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 PlaylistParser so intervening tags don’t accidentally capture segment URIs.
  • Add JUnit coverage for PDT-before-#EXTINF and 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.

Comment thread src/main/java/com/comcast/viper/hlsparserj/PlaylistParser.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread src/main/java/com/comcast/viper/hlsparserj/PlaylistParser.java
Comment thread src/main/java/com/comcast/viper/hlsparserj/PlaylistParser.java
Comment thread src/main/java/com/comcast/viper/hlsparserj/PlaylistParser.java

@diego-ferrand diego-ferrand left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

@Baraujo25
Baraujo25 merged commit 644693f into master Jun 3, 2026
2 checks passed
@Baraujo25
Baraujo25 deleted the URI_RESOLUTION branch June 3, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants