Skip to content

Commit

Permalink
feat: Set maxDisabledTime to 1 by default for low latency streaming (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored May 15, 2024
1 parent f4bcb35 commit 1cdbbe0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/tutorials/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ With `.streaming.lowLatencyMode` set to true,
`.streaming.rebufferingGoal` is set to 0.01 by default,
`.streaming.segmentPrefetchLimit` is set to 2 by default,
`.streaming.updateIntervalSeconds` is set to 0.1 by default,
`.streaming.maxDisabledTime` is set to 1 by default,
`.streaming.retryParameters.baseDelay` is set to 100 by default,
`.manifest.dash.autoCorrectDrift` is set to false by default,
`.manifest.retryParameters.baseDelay` is set to 100 by default, and
Expand All @@ -143,6 +144,7 @@ player.configure({
rebufferingGoal: 0.01,
segmentPrefetchLimit: 2,
updateIntervalSeconds: 0.1,
maxDisabledTime: 1,
retryParameters: {
baseDelay: 100,
},
Expand Down
12 changes: 8 additions & 4 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3399,10 +3399,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {

// If lowLatencyMode is enabled, and inaccurateManifestTolerance and
// rebufferingGoal and segmentPrefetchLimit and baseDelay and
// autoCorrectDrift are not specified, set inaccurateManifestTolerance to 0
// and rebufferingGoal to 0.01 and segmentPrefetchLimit to 2 and
// updateIntervalSeconds to 0.1 and baseDelay to 100 and autoCorrectDrift
// to false by default for low latency streaming.
// autoCorrectDrift and maxDisabledTime are not specified, set
// inaccurateManifestTolerance to 0 and rebufferingGoal to 0.01 and
// segmentPrefetchLimit to 2 and updateIntervalSeconds to 0.1 and and
// baseDelay to 100 and autoCorrectDrift to false and maxDisabledTime
// to 1 by default for low latency streaming.
if (config['streaming'] && config['streaming']['lowLatencyMode']) {
if (config['streaming']['inaccurateManifestTolerance'] == undefined) {
config['streaming']['inaccurateManifestTolerance'] = 0;
Expand All @@ -3416,6 +3417,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (config['streaming']['updateIntervalSeconds'] == undefined) {
config['streaming']['updateIntervalSeconds'] = 0.1;
}
if (config['streaming']['maxDisabledTime'] == undefined) {
config['streaming']['maxDisabledTime'] = 1;
}
if (config['streaming']['retryParameters'] == undefined) {
config['streaming']['retryParameters'] = {};
}
Expand Down
3 changes: 3 additions & 0 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ describe('Player', () => {
inaccurateManifestTolerance: 1,
segmentPrefetchLimit: 1,
updateIntervalSeconds: 10,
maxDisabledTime: 10,
retryParameters: {
baseDelay: 2000,
},
Expand All @@ -1239,6 +1240,7 @@ describe('Player', () => {
expect(player.getConfiguration().streaming.segmentPrefetchLimit).toBe(1);
expect(player.getConfiguration().streaming.updateIntervalSeconds)
.toBe(10);
expect(player.getConfiguration().streaming.maxDisabledTime).toBe(10);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(2000);
expect(player.getConfiguration().manifest.dash.autoCorrectDrift)
Expand All @@ -1259,6 +1261,7 @@ describe('Player', () => {
expect(player.getConfiguration().streaming.segmentPrefetchLimit).toBe(2);
expect(player.getConfiguration().streaming.updateIntervalSeconds)
.toBe(0.1);
expect(player.getConfiguration().streaming.maxDisabledTime).toBe(1);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(100);
expect(player.getConfiguration().manifest.dash.autoCorrectDrift)
Expand Down

0 comments on commit 1cdbbe0

Please sign in to comment.