Skip to content

Commit

Permalink
Add config field to ignore manifest minBufferTime shaka-project#1547 (s…
Browse files Browse the repository at this point in the history
…haka-project#1581)

Add the config field manifest.dash.ignoreMinBufferTime, which will default to false. If true, the DASH parser will ignore minBufferTime in the manifest, such that streaming.rebufferingGoal is the only factor in play.

Closes shaka-project#1547
  • Loading branch information
fadomire authored and joeyparrish committed Sep 21, 2018
1 parent 71f2604 commit 99ebc69
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Alugha GmbH <*@alugha.com>
Bonnier Broadcasting <*@bonnierbroadcasting.com>
Bryan Huh <bhh1988@gmail.com>
Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
Google Inc. <*@google.com>
Edgeware AB <*@edgeware.tv>
Giuseppe Samela <giuseppe.samela@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Costel Madalin Grecu <madalin.grecu@adswizz.com>
Donato Borrello <donato@jwplayer.com>
Duc Pham <duc.pham@edgeware.tv>
Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
François Beaufort <fbeaufort@google.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Itay Kinnrot <itay.kinnrot@kaltura.com>
Expand Down
7 changes: 6 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ shaka.extern.DrmConfiguration;
* clockSyncUri: string,
* ignoreDrmInfo: boolean,
* xlinkFailGracefully: boolean,
* defaultPresentationDelay: number
* defaultPresentationDelay: number,
* ignoreMinBufferTime: boolean
* }}
*
* @property {shaka.extern.DashContentProtectionCallback} customScheme
Expand All @@ -536,6 +537,10 @@ shaka.extern.DrmConfiguration;
* @property {number} defaultPresentationDelay
* A default presentationDelay if suggestedPresentationDelay is missing
* in the MPEG DASH manifest. This has to be bigger than minBufferTime * 1.5.
* @property {boolean} ignoreMinBufferTime
* If true will cause DASH parser to ignore minBufferTime from manifest.
* It allows player config to take precedence over manifest for
* rebufferingGoal. Defaults to false if not provided.
*
* @exportDoc
*/
Expand Down
7 changes: 6 additions & 1 deletion lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,13 @@ shaka.dash.DashParser.prototype.processManifest_ =
let baseUris = shaka.util.ManifestParserUtils.resolveUris(
manifestBaseUris, uris);

let minBufferTime =
let ignoreMinBufferTime = this.config_.dash.ignoreMinBufferTime;
let minBufferTime;
if (!ignoreMinBufferTime) {
minBufferTime =
XmlUtils.parseAttr(mpd, 'minBufferTime', XmlUtils.parseDuration);
}

this.updatePeriod_ = /** @type {number} */ (XmlUtils.parseAttr(
mpd, 'minimumUpdatePeriod', XmlUtils.parseDuration, -1));

Expand Down
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ shaka.util.PlayerConfiguration = class {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
};

Expand Down
1 change: 1 addition & 0 deletions test/dash/dash_parser_content_protection_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('DashParser ContentProtection', function() {
ignoreDrmInfo: ignoreDrmInfo,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});
let playerEvents = {
Expand Down
2 changes: 2 additions & 0 deletions test/dash/dash_parser_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('DashParser Live', function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});
playerInterface = {
Expand Down Expand Up @@ -713,6 +714,7 @@ describe('DashParser Live', function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});

Expand Down
64 changes: 64 additions & 0 deletions test/dash/dash_parser_manifest_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1126,4 +1126,68 @@ describe('DashParser Manifest', function() {
expect(variant.video.originalId).toEqual('video-sd');
expect(textStream.originalId).toEqual('text-en');
});

it('override manifest value if ignoreMinBufferTime is true', async () => {
let manifestText = [
'<MPD minBufferTime="PT75S">',
' <Period id="1" duration="PT30S">',
' <AdaptationSet id="1" mimeType="video/mp4">',
' <Representation id="video-sd" width="640" height="480">',
' <BaseURL>v-sd.mp4</BaseURL>',
' <SegmentBase indexRange="100-200" />',
' </Representation>',
' </AdaptationSet>',
' </Period>',
'</MPD>',
].join('\n');

fakeNetEngine.setResponseText('dummy://foo', manifestText);
parser.configure({
retryParameters: shaka.net.NetworkingEngine.defaultRetryParameters(),
availabilityWindowOverride: NaN,
dash: {
clockSyncUri: '',
customScheme: function(node) { return null; },
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: true,
},
});
const manifest = await parser.start('dummy://foo', playerInterface);
const minBufferTime = manifest.minBufferTime;
expect(minBufferTime).toEqual(0);
});

it('get manifest value if ignoreMinBufferTime is false', async () => {
let manifestText = [
'<MPD minBufferTime="PT75S">',
' <Period id="1" duration="PT30S">',
' <AdaptationSet id="1" mimeType="video/mp4">',
' <Representation id="video-sd" width="640" height="480">',
' <BaseURL>v-sd.mp4</BaseURL>',
' <SegmentBase indexRange="100-200" />',
' </Representation>',
' </AdaptationSet>',
' </Period>',
'</MPD>',
].join('\n');

fakeNetEngine.setResponseText('dummy://foo', manifestText);
parser.configure({
retryParameters: shaka.net.NetworkingEngine.defaultRetryParameters(),
availabilityWindowOverride: NaN,
dash: {
clockSyncUri: '',
customScheme: function(node) { return null; },
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});
const manifest = await parser.start('dummy://foo', playerInterface);
const minBufferTime = manifest.minBufferTime;
expect(minBufferTime).toEqual(75);
});
});
2 changes: 2 additions & 0 deletions test/hls/hls_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ describe('HlsParser live', function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
};

Expand Down Expand Up @@ -498,6 +499,7 @@ describe('HlsParser live', function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});

Expand Down
1 change: 1 addition & 0 deletions test/hls/hls_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe('HlsParser', function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
};

Expand Down
1 change: 1 addition & 0 deletions test/test/util/dash_parser_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ shaka.test.Dash.makeDashParser = function() {
ignoreDrmInfo: false,
xlinkFailGracefully: false,
defaultPresentationDelay: 10,
ignoreMinBufferTime: false,
},
});
return parser;
Expand Down

0 comments on commit 99ebc69

Please sign in to comment.