Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Set updateIntervalSeconds to 0.1 by default for low latency streaming #6403

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/tutorials/config.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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