Skip to content

Commit

Permalink
feat(HLS): Allow delivery directives in Live streams (shaka-project#5292
Browse files Browse the repository at this point in the history
)

According to
https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.2.5
delivery directives are allowed for all live content
  • Loading branch information
avelad committed Jun 13, 2023
1 parent f4bcc87 commit aedf634
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions lib/hls/hls_parser.js
Expand Up @@ -345,29 +345,27 @@ shaka.hls.HlsParser = class {
async updateStream_(streamInfo) {
const manifestUri = streamInfo.absoluteMediaPlaylistUri;
const uriObj = new goog.Uri(manifestUri);
if (this.lowLatencyMode_) {
const queryData = new goog.Uri.QueryData();
if (streamInfo.canSkipSegments) {
// Enable delta updates. This will replace older segments with
// 'EXT-X-SKIP' tag in the media playlist.
queryData.add('_HLS_skip', 'YES');
}
if (streamInfo.canBlockReload) {
if (streamInfo.nextMediaSequence >= 0) {
// Indicates that the server must hold the request until a Playlist
// contains a Media Segment with Media Sequence
queryData.add('_HLS_msn', String(streamInfo.nextMediaSequence));
}
if (streamInfo.nextPart >= 0) {
// Indicates, in combination with _HLS_msn, that the server must hold
// the request until a Playlist contains Partial Segment N of Media
// Sequence Number M or later.
queryData.add('_HLS_part', String(streamInfo.nextPart));
}
}
if (queryData.getCount()) {
uriObj.setQueryData(queryData);
}
const queryData = new goog.Uri.QueryData();
if (streamInfo.canSkipSegments) {
// Enable delta updates. This will replace older segments with
// 'EXT-X-SKIP' tag in the media playlist.
queryData.add('_HLS_skip', 'YES');
}
if (streamInfo.canBlockReload) {
if (streamInfo.nextMediaSequence >= 0) {
// Indicates that the server must hold the request until a Playlist
// contains a Media Segment with Media Sequence
queryData.add('_HLS_msn', String(streamInfo.nextMediaSequence));
}
if (streamInfo.nextPart >= 0) {
// Indicates, in combination with _HLS_msn, that the server must hold
// the request until a Playlist contains Partial Segment N of Media
// Sequence Number M or later.
queryData.add('_HLS_part', String(streamInfo.nextPart));
}
}
if (queryData.getCount()) {
uriObj.setQueryData(queryData);
}
const response =
await this.requestManifest_(uriObj.toString(), /* isPlaylist= */ true);
Expand Down

0 comments on commit aedf634

Please sign in to comment.