Comcast / mamba

Mamba is a Swift iOS, tvOS and macOS framework to parse, validate and write HTTP Live Streaming (HLS) data.
Apache License 2.0
180 stars 40 forks source link

EXT-X-DATERANGE support #83

Closed theRealRobG closed 4 years ago

theRealRobG commented 4 years ago

Description

This PR attempts to add EXT-X-DATERANGE as a tag that is recognised by Mamba under PantosTag, along with the attributes that the tag supports. The attributes were taken from draft-pantos-hls-rfc8216bis-05.

Change Notes

There are some concerns I have with the changes:

PlaylistTagDescriptorScope

The PlaylistTagDescriptorScope has been defined to be .wholePlaylist, rather than .mediaSegment, or .mediaSpanning, but in actuality, it seems to be its own category entirely in the draft HLS specification, under "Media Metadata Tags". The following is said about this category in the specification:

 Media Metadata tags provide information about the playlist that is
 not associated with specific Media Segments.

As such, it seemed that the closest descriptive case of scope seems to be wholePlaylist; that being said, I don't fully understand the implications of the scope, and the tag actually is applied to a date range of the whole playlist. Perhaps a new case should be added... I will leave that up to a decision in the review.

Error severity

I'm not entirely sure what the error severity is actually supposed to indicate. I've chosen all of the validation errors for EXT-X-DATERANGE to be .error, since all the rules I have implemented are indicated as MUST in the specification. That being said, there is this line in the specification that indicates that any syntax error for a EXT-X-DATERANGE tag, should just be treated as the tag being ignored (so it is not an error for the whole playlist):

Clients SHOULD ignore EXT-X-DATERANGE tags with illegal syntax.

Some advice on what direction I should take with this would be appreciated.

Pre-submission Checklist

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

dcoufal commented 4 years ago

The main use of PlaylistTagDescriptorScope is for automatic creation of "structure" for parsed playlists. You may have noticed that we have header, mediaSegmentGroups, and footer groups of tags in HLSPlaylistInterface, as well as mediaSpans.

Given the nature of the tag, I'd say that .wholePlaylist is accurate. It does not describe a fragment nor a group of fragments.

dcoufal commented 4 years ago

Re: Error handling. Generally, a validation error should mean that the playlist is unplayable.

If it's explicitly stated that malformed EXT-X-DATERANGE are just ignored, I would drop them down to warnings.