Skip to content

Commit

Permalink
feat: Set updateIntervalSeconds to 0.1 by default for low latency str…
Browse files Browse the repository at this point in the history
…eaming (#6403)
  • Loading branch information
avelad committed Apr 5, 2024
1 parent 966302d commit 9838622
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/tutorials/config.md
Expand Up @@ -126,20 +126,22 @@ With `.streaming.lowLatencyMode` set to true,
`.streaming.inaccurateManifestTolerance` is set to 0 by default,
`.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.retryParameters.baseDelay` is set to 100 by default,
`.manifest.retryParameters.baseDelay` is set to 100 by default, and
`.drm.retryParameters.baseDelay` is set to 100 by default.

To customize the values of inaccurateManifestTolerance, rebufferingGoal,
segmentPrefetchLimit and baseDelay with low latency mode, you can set the
fields in the same or subsequent call to configure().
segmentPrefetchLimit, updateIntervalSeconds and baseDelay with low latency
mode, you can set the fields in the same or subsequent call to configure().
```js
player.configure({
streaming: {
lowLatencyMode: true,
inaccurateManifestTolerance: 0,
rebufferingGoal: 0.01,
segmentPrefetchLimit: 2,
updateIntervalSeconds: 0.1,
retryParameters: {
baseDelay: 100,
},
Expand Down
7 changes: 5 additions & 2 deletions lib/player.js
Expand Up @@ -3251,8 +3251,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// If lowLatencyMode is enabled, and inaccurateManifestTolerance and
// rebufferingGoal and segmentPrefetchLimit and baseDelay are not
// specified, set inaccurateManifestTolerance to 0 and rebufferingGoal
// to 0.01 and segmentPrefetchLimit to 2 and baseDelay to 100 by default
// for low latency streaming.
// to 0.01 and segmentPrefetchLimit to 2 and updateIntervalSeconds to
// 0.1 and baseDelay to 100 by default for low latency streaming.
if (config['streaming'] && config['streaming']['lowLatencyMode']) {
if (config['streaming']['inaccurateManifestTolerance'] == undefined) {
config['streaming']['inaccurateManifestTolerance'] = 0;
Expand All @@ -3263,6 +3263,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (config['streaming']['segmentPrefetchLimit'] == undefined) {
config['streaming']['segmentPrefetchLimit'] = 2;
}
if (config['streaming']['updateIntervalSeconds'] == undefined) {
config['streaming']['updateIntervalSeconds'] = 0.1;
}
if (config['streaming']['retryParameters'] == undefined) {
config['streaming']['retryParameters'] = {};
}
Expand Down
5 changes: 5 additions & 0 deletions test/player_unit.js
Expand Up @@ -1210,6 +1210,7 @@ describe('Player', () => {
rebufferingGoal: 1,
inaccurateManifestTolerance: 1,
segmentPrefetchLimit: 1,
updateIntervalSeconds: 10,
retryParameters: {
baseDelay: 2000,
},
Expand All @@ -1229,6 +1230,8 @@ describe('Player', () => {
expect(player.getConfiguration().streaming.inaccurateManifestTolerance)
.toBe(1);
expect(player.getConfiguration().streaming.segmentPrefetchLimit).toBe(1);
expect(player.getConfiguration().streaming.updateIntervalSeconds)
.toBe(10);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(2000);
expect(player.getConfiguration().manifest.retryParameters.baseDelay)
Expand All @@ -1245,6 +1248,8 @@ describe('Player', () => {
expect(player.getConfiguration().streaming.inaccurateManifestTolerance)
.toBe(0);
expect(player.getConfiguration().streaming.segmentPrefetchLimit).toBe(2);
expect(player.getConfiguration().streaming.updateIntervalSeconds)
.toBe(0.1);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(100);
expect(player.getConfiguration().manifest.retryParameters.baseDelay)
Expand Down

0 comments on commit 9838622

Please sign in to comment.