Skip to content

Commit

Permalink
Do not require EXT-X-MEDIA-SEQUENCE in HLS live
Browse files Browse the repository at this point in the history
Closes shaka-project#1189

Change-Id: Iae6f4f4524bb9895f8b211491793cf7626661a5d
  • Loading branch information
joeyparrish committed Dec 13, 2017
1 parent 2075050 commit 2e5b856
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
15 changes: 0 additions & 15 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ shaka.hls.HlsParser.prototype.updateStream_ = function(streamInfo, uri) {

var mediaSequenceTag = Utils.getFirstTagWithName(playlist.tags,
'EXT-X-MEDIA-SEQUENCE');
if (this.presentationType_ == PresentationType.LIVE && !mediaSequenceTag) {
// This only applies to LIVE, not EVENT.
throw new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MANIFEST,
shaka.util.Error.Code.HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS);
}

var startPosition = mediaSequenceTag ? Number(mediaSequenceTag.value) : 0;
var stream = streamInfo.stream;
Expand Down Expand Up @@ -845,7 +838,6 @@ shaka.hls.HlsParser.prototype.createStreamInfo_ = function(uri, allCodecs,
var Utils = shaka.hls.Utils;
var ContentType = shaka.util.ManifestParserUtils.ContentType;
var HlsParser = shaka.hls.HlsParser;
var PresentationType = shaka.hls.HlsParser.PresentationType_;

var relativeUri = uri;
uri = Utils.constructAbsoluteUri(this.manifestUri_, uri);
Expand Down Expand Up @@ -879,13 +871,6 @@ shaka.hls.HlsParser.prototype.createStreamInfo_ = function(uri, allCodecs,

var mediaSequenceTag = Utils.getFirstTagWithName(playlist.tags,
'EXT-X-MEDIA-SEQUENCE');
if (this.presentationType_ == PresentationType.LIVE && !mediaSequenceTag) {
// This only applies to LIVE, not EVENT.
throw new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MANIFEST,
shaka.util.Error.Code.HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS);
}

var startPosition = mediaSequenceTag ? Number(mediaSequenceTag.value) : 0;

Expand Down
6 changes: 1 addition & 5 deletions lib/util/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,7 @@ shaka.util.Error.Code = {
*/
'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,

/**
* HLS parser was unable to find the EXT-X-MEDIA-SEQUENCE tag, which this
* implementation requires for live HLS streams.
*/
'HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS': 4031,
// RETIRED: 'HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS': 4031,


// RETIRED: 'INCONSISTENT_BUFFER_STATE': 5000,
Expand Down
17 changes: 17 additions & 0 deletions test/hls/hls_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ describe('HlsParser live', function() {
'test:/main.mp4\n'
].join('');

var mediaWithoutSequenceNumber = [
'#EXTM3U\n',
'#EXT-X-TARGETDURATION:5\n',
'#EXTINF:2,\n',
'test:/main.mp4\n'
].join('');

var mediaWithByteRange = [
'#EXTM3U\n',
'#EXT-X-TARGETDURATION:5\n',
Expand Down Expand Up @@ -380,6 +387,16 @@ describe('HlsParser live', function() {
}).catch(fail).then(done);
});

it('does not fail on a missing sequence number', function(done) {
fakeNetEngine.setResponseMap({
'test:/master': toUTF8(master),
'test:/video': toUTF8(mediaWithoutSequenceNumber),
'test:/main.mp4': segmentData
});

parser.start('test:/master', playerInterface).catch(fail).then(done);
});

describe('update', function() {
beforeAll(function() {
jasmine.clock().install();
Expand Down

0 comments on commit 2e5b856

Please sign in to comment.