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(parser): ensure dateRange uses startDate for condition #187

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pmendozav
Copy link

related with issue #186

@ishish
Copy link

ishish commented Jan 22, 2025

Is there an update on this can we get it merged?

gkatsev
gkatsev previously approved these changes Jan 28, 2025
@gkatsev gkatsev dismissed their stale review January 28, 2025 20:31

not inherently wrong, but there's more to it

Copy link
Contributor

@adrums86 adrums86 left a comment

Choose a reason for hiding this comment

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

Thanks for submitting a fix! I agree this could be handled better. I think we might just want to be careful about possibly creating out of spec dateRange tags so lets see if we can do this as close to spec as possible.

@@ -715,7 +715,7 @@ export default class Parser extends Stream {
message: 'EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes'
});
}
if (dateRange.duration && dateRange.endDate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll defer to the discussion in #186 , but I think we may want to do something like

if (dateRange.startDate && dateRange.duration && dateRange.endDate)

instead.
Perhaps with a warning and early return if the startDate + duration !== endDate to ensure we don't create any bad dateRanges.

Copy link
Author

@pmendozav pmendozav Jan 29, 2025

Choose a reason for hiding this comment

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

@adrums86

I updated the constraint to include dateRange.endDate, ensuring that dateRanges[index].endDate is created according to the specification and that a valid startDate is present. This should be sufficient to prevent the creation of invalid dateRanges, as you mentioned.

Additionally, I added a warning.

Triggers a warn event when an EXT-X-DATERANGE tag includes both DURATION and END-DATE but lacks the required START-DATE. Ensures better HLS spec compliance.
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.

4 participants