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 autoCorrectDrift to false by default for low latency streaming #6549

Merged
merged 2 commits into from
May 7, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/tutorials/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ With `.streaming.lowLatencyMode` set to true,
`.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.dash.autoCorrectDrift` is set to false by default,
`.manifest.retryParameters.baseDelay` is set to 100 by default, and
`.drm.retryParameters.baseDelay` is set to 100 by default.

Expand All @@ -147,6 +148,9 @@ player.configure({
},
},
manifest: {
dash: {
autoCorrectDrift: true,
},
retryParameters: {
baseDelay: 100,
},
Expand Down
5 changes: 2 additions & 3 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,8 @@ shaka.extern.ManifestConfiguration;
* extra segment requests necessary to compensate for drift.
* @property {boolean} lowLatencyMode
* If <code>true</code>, low latency streaming mode is enabled. If
* lowLatencyMode is set to true, inaccurateManifestTolerance is set to 0
* unless specified, and rebufferingGoal to 0.01 unless specified at the same
* time.
* lowLatencyMode is set to true, it changes the default config values for
* other things, see: docs/tutorials/config.md
* @property {boolean} autoLowLatencyMode
* If the stream is low latency and the user has not configured the
* lowLatencyMode, but if it has been configured to activate the
Expand Down
15 changes: 11 additions & 4 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3359,10 +3359,11 @@ 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 updateIntervalSeconds to
// 0.1 and baseDelay to 100 by default for low latency streaming.
// 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.
if (config['streaming'] && config['streaming']['lowLatencyMode']) {
if (config['streaming']['inaccurateManifestTolerance'] == undefined) {
config['streaming']['inaccurateManifestTolerance'] = 0;
Expand All @@ -3385,6 +3386,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (config['manifest'] == undefined) {
config['manifest'] = {};
}
if (config['manifest']['dash'] == undefined) {
config['manifest']['dash'] = {};
}
if (config['manifest']['dash']['autoCorrectDrift'] == undefined) {
config['manifest']['dash']['autoCorrectDrift'] = false;
}
if (config['manifest']['retryParameters'] == undefined) {
config['manifest']['retryParameters'] = {};
}
Expand Down
7 changes: 7 additions & 0 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,9 @@ describe('Player', () => {
},
},
manifest: {
dash: {
autoCorrectDrift: true,
},
retryParameters: {
baseDelay: 2000,
},
Expand All @@ -1238,6 +1241,8 @@ describe('Player', () => {
.toBe(10);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(2000);
expect(player.getConfiguration().manifest.dash.autoCorrectDrift)
.toBe(true);
expect(player.getConfiguration().manifest.retryParameters.baseDelay)
.toBe(2000);
expect(player.getConfiguration().drm.retryParameters.baseDelay)
Expand All @@ -1256,6 +1261,8 @@ describe('Player', () => {
.toBe(0.1);
expect(player.getConfiguration().streaming.retryParameters.baseDelay)
.toBe(100);
expect(player.getConfiguration().manifest.dash.autoCorrectDrift)
.toBe(false);
expect(player.getConfiguration().manifest.retryParameters.baseDelay)
.toBe(100);
expect(player.getConfiguration().drm.retryParameters.baseDelay)
Expand Down