Skip to content

Commit

Permalink
Increase HLS partial segment size
Browse files Browse the repository at this point in the history
This increases the amount of data we fetch to get HLS segment start
times.  The presence of a large PSSH box in Widevine-encrypted content
was pushing the "tfdt" box past the 1kB mark, so we will now fetch
2kB.

Issue #1137
References FR in shaka-project/shaka-packager#294

Change-Id: I51a1407c4d992e42d07c3e6c6c501051100d1620
  • Loading branch information
joeyparrish committed Nov 21, 2017
1 parent 156dd3c commit 6e626cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,12 @@ shaka.hls.HlsParser.prototype.getStartTime_ =
shaka.log.debug('Unable to find segment start time in previous manifest!');
}

// TODO: Introduce a new tag to extend HLS and provide the first segment's
// start time. This will avoid the need for these fetches in content packaged
// with Shaka Packager. This web-friendly extension to HLS can then be
// proposed to Apple for inclusion in a future version of HLS.
// See https://github.com/google/shaka-packager/issues/294

shaka.log.v1('Fetching segment to find start time');
return this.fetchPartialSegment_(segmentRef).then(function(response) {
if (mimeType == 'video/mp4' || mimeType == 'audio/mp4') {
Expand Down Expand Up @@ -1977,7 +1983,7 @@ shaka.hls.HlsParser.TS_TIMESCALE_ = 90000;
* @const {number}
* @private
*/
shaka.hls.HlsParser.PARTIAL_SEGMENT_SIZE_ = 1024;
shaka.hls.HlsParser.PARTIAL_SEGMENT_SIZE_ = 2048;


shaka.media.ManifestParser.registerParserByExtension(
Expand Down
2 changes: 1 addition & 1 deletion test/hls/hls_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ describe('HlsParser live', function() {

it('gets start time of segments with byte range', function(done) {
// Nit: this value is an implementation detail of the fix for #1106
var partialEndByte = expectedStartByte + 1024 - 1;
var partialEndByte = expectedStartByte + 2048 - 1;

fakeNetEngine.setResponseMap({
'test:/master': toUTF8(master),
Expand Down
2 changes: 1 addition & 1 deletion test/hls/hls_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ describe('HlsParser', function() {
var expectedStartByte = 616;
var expectedEndByte = 121705;
// Nit: this value is an implementation detail of the fix for #1106
var partialEndByte = expectedStartByte + 1024 - 1;
var partialEndByte = expectedStartByte + 2048 - 1;

beforeEach(function() {
// TODO: use StreamGenerator?
Expand Down

0 comments on commit 6e626cc

Please sign in to comment.