Skip to content

Commit

Permalink
Change so that default presentation delay for DASH is configurable (#…
Browse files Browse the repository at this point in the history
…1235)

It is useful to have the default presentation delay configurable when the stream provider isn't able to add `suggestedPresentationDelay` in the manifest

Fixes #1234
  • Loading branch information
Benjamin Wallberg authored and joeyparrish committed Jan 22, 2018
1 parent d89cd31 commit 7736c5f
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 21 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Please keep the list sorted.

AdsWizz <*@adswizz.com>
Bonnier Broadcasting <*@bonnierbroadcasting.com>
Bryan Huh <[email protected]>
Esteban Dosztal <[email protected]>
Google Inc. <*@google.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

Aaron Vaage <[email protected]>
Andy Hochhaus <[email protected]>
Benjamin Wallberg <[email protected]>
Bryan Huh <[email protected]>
Chad Assareh <[email protected]>
Chris Fillmore <[email protected]>
Expand Down
6 changes: 5 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ shakaExtern.DrmConfiguration;
* customScheme: shakaExtern.DashContentProtectionCallback,
* clockSyncUri: string,
* ignoreDrmInfo: boolean,
* xlinkFailGracefully: boolean
* xlinkFailGracefully: boolean,
* defaultPresentationDelay: number
* }}
*
* @property {shakaExtern.DashContentProtectionCallback} customScheme
Expand All @@ -510,6 +511,9 @@ shakaExtern.DrmConfiguration;
* existing contents. If false, xlink-related errors will be propagated
* to the application and will result in a playback failure. Defaults to
* false if not provided.
* @property {number} defaultPresentationDelay
* A default presentationDelay if suggestedPresentationDelay is missing
* in the MPEG DASH manifest, has to be bigger than minBufferTime * 1.5.
*
* @exportDoc
*/
Expand Down
19 changes: 5 additions & 14 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ shaka.dash.DashParser = function() {
shaka.dash.DashParser.MIN_UPDATE_PERIOD_ = 3;


/**
* The default MPD@suggestedPresentationDelay in seconds.
*
* @private
* @const {number}
*/
shaka.dash.DashParser.DEFAULT_SUGGESTED_PRESENTATION_DELAY_ = 10;


/**
* @typedef {
* !function(!Array.<string>, ?number, ?number):!Promise.<!ArrayBuffer>
Expand Down Expand Up @@ -495,12 +486,12 @@ shaka.dash.DashParser.prototype.processManifest_ =
// available, and anything less than minBufferTime will cause buffering
// issues.
//
// We have decided that our default will be 1.5 * minBufferTime, or 10s,
// whichever is larger. This is fairly conservative. Content providers
// should provide a suggestedPresentationDelay whenever possible to optimize
// the live streaming experience.
// We have decided that our default will be 1.5 * minBufferTime,
// or 10s (configurable) whichever is larger. This is fairly conservative.
// Content providers should provide a suggestedPresentationDelay
// whenever possible to optimize the live streaming experience.
var defaultPresentationDelay = Math.max(
shaka.dash.DashParser.DEFAULT_SUGGESTED_PRESENTATION_DELAY_,
this.config_.dash.defaultPresentationDelay,
minBufferTime * 1.5);
var presentationDelay = suggestedPresentationDelay != null ?
suggestedPresentationDelay : defaultPresentationDelay;
Expand Down
3 changes: 2 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,8 @@ shaka.Player.prototype.defaultConfig_ = function() {
},
clockSyncUri: '',
ignoreDrmInfo: false,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
},
streaming: {
Expand Down
3 changes: 2 additions & 1 deletion test/dash/dash_parser_content_protection_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ describe('DashParser ContentProtection', function() {
clockSyncUri: '',
customScheme: callback,
ignoreDrmInfo: ignoreDrmInfo,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
});
var playerEvents = {
Expand Down
3 changes: 2 additions & 1 deletion test/dash/dash_parser_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe('DashParser Live', function() {
clockSyncUri: '',
customScheme: function(node) { return null; },
ignoreDrmInfo: false,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
});
playerInterface = {
Expand Down
3 changes: 2 additions & 1 deletion test/hls/hls_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ describe('HlsParser live', function() {
customScheme: function(node) { return null; },
clockSyncUri: '',
ignoreDrmInfo: false,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
};

Expand Down
3 changes: 2 additions & 1 deletion test/hls/hls_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ describe('HlsParser', function() {
customScheme: function(node) { return null; },
clockSyncUri: '',
ignoreDrmInfo: false,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
};

Expand Down
3 changes: 2 additions & 1 deletion test/test/util/dash_parser_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ shaka.test.Dash.makeDashParser = function() {
customScheme: function(node) { return null; },
clockSyncUri: '',
ignoreDrmInfo: false,
xlinkFailGracefully: false
xlinkFailGracefully: false,
defaultPresentationDelay: 10
}
});
return parser;
Expand Down

0 comments on commit 7736c5f

Please sign in to comment.