eyevinn-channel-engine 3.3.2 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/engine/server.js +5 -0
- package/engine/session.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,6 +109,7 @@ Available options when constructing the Channel Engine object are:
|
|
|
109
109
|
- `cloudWatchMetrics`: Output CloudWatch JSON metrics on console log. Default is false.
|
|
110
110
|
- `useDemuxedAudio`: Enable playing VODs with multiple audio tracks. Default is false.
|
|
111
111
|
- `alwaysNewSegments`: Force all new HLS media sequences to always contain at least 1 new segment. Default is false.
|
|
112
|
+
- `diffCompensationRate`: The rate for how much time is added on each sequence to slow down the playhead until it is back on schedule. Default is 0.5 (delay with half a segment duration).
|
|
112
113
|
|
|
113
114
|
## High Availability
|
|
114
115
|
|
package/engine/server.js
CHANGED
|
@@ -109,6 +109,9 @@ class ChannelEngine {
|
|
|
109
109
|
if (options && options.forceTargetDuration) {
|
|
110
110
|
this.streamerOpts.forceTargetDuration = options.forceTargetDuration;
|
|
111
111
|
}
|
|
112
|
+
if (options && options.diffCompensationRate) {
|
|
113
|
+
this.streamerOpts.diffCompensationRate = options.diffCompensationRate;
|
|
114
|
+
}
|
|
112
115
|
const handleMasterRoute = async (req, res, next) => {
|
|
113
116
|
debug(req.params);
|
|
114
117
|
let m;
|
|
@@ -237,6 +240,7 @@ class ChannelEngine {
|
|
|
237
240
|
maxTickInterval: channel.options && channel.options.maxTickInterval ? channel.options.maxTickInterval : this.streamerOpts.defaultMaxTickInterval,
|
|
238
241
|
targetDurationPadding: channel.options && channel.options.targetDurationPadding ? channel.options.targetDurationPadding : this.streamerOpts.targetDurationPadding,
|
|
239
242
|
forceTargetDuration: channel.options && channel.options.forceTargetDuration ? channel.options.forceTargetDuration : this.streamerOpts.forceTargetDuration,
|
|
243
|
+
diffCompensationRate: channel.options && channel.options.diffCompensationRate ? channel.options.diffCompensationRate : this.streamerOpts.diffCompensationRate,
|
|
240
244
|
profile: channel.profile,
|
|
241
245
|
audioTracks: channel.audioTracks,
|
|
242
246
|
closedCaptions: channel.closedCaptions,
|
|
@@ -454,6 +458,7 @@ class ChannelEngine {
|
|
|
454
458
|
options.maxTickInterval = this.streamerOpts.defaultMaxTickInterval;
|
|
455
459
|
options.targetDurationPadding = this.streamerOpts.targetDurationPadding;
|
|
456
460
|
options.forceTargetDuration = this.streamerOpts.forceTargetDuration;
|
|
461
|
+
options.diffCompensationRate = this.streamerOpts.diffCompensationRate;
|
|
457
462
|
// if we are initiating a master manifest
|
|
458
463
|
// outside of specific Channel context,
|
|
459
464
|
// if slate options are set at the ChannelEngine level, then set these here
|
package/engine/session.js
CHANGED
|
@@ -15,7 +15,7 @@ const ChaosMonkey = require('./chaos_monkey.js');
|
|
|
15
15
|
const AVERAGE_SEGMENT_DURATION = 3000;
|
|
16
16
|
const DEFAULT_PLAYHEAD_DIFF_THRESHOLD = 1000;
|
|
17
17
|
const DEFAULT_MAX_TICK_INTERVAL = 10000;
|
|
18
|
-
const
|
|
18
|
+
const DEFAULT_DIFF_COMPENSATION_RATE = 0.5;
|
|
19
19
|
|
|
20
20
|
const timer = ms => new Promise(res => setTimeout(res, ms));
|
|
21
21
|
|
|
@@ -43,6 +43,7 @@ class Session {
|
|
|
43
43
|
this.cloudWatchLogging = false;
|
|
44
44
|
this.playheadDiffThreshold = DEFAULT_PLAYHEAD_DIFF_THRESHOLD;
|
|
45
45
|
this.maxTickInterval = DEFAULT_MAX_TICK_INTERVAL;
|
|
46
|
+
this.diffCompensationRate = DEFAULT_DIFF_COMPENSATION_RATE;
|
|
46
47
|
this.diffCompensation = null;
|
|
47
48
|
this.timePositionOffset = 0;
|
|
48
49
|
this.prevVodMediaSeq = {
|
|
@@ -119,6 +120,9 @@ class Session {
|
|
|
119
120
|
if (config.forceTargetDuration) {
|
|
120
121
|
this.forceTargetDuration = config.forceTargetDuration;
|
|
121
122
|
}
|
|
123
|
+
if (config.diffCompensationRate) {
|
|
124
|
+
this.diffCompensationRate = config.diffCompensationRate;
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -213,7 +217,7 @@ class Session {
|
|
|
213
217
|
}
|
|
214
218
|
// Apply external diff compensation if available.
|
|
215
219
|
if (this.diffCompensation && this.diffCompensation > 0) {
|
|
216
|
-
const DIFF_COMPENSATION = (reqTickInterval *
|
|
220
|
+
const DIFF_COMPENSATION = (reqTickInterval * this.diffCompensationRate).toFixed(2) * 1000;
|
|
217
221
|
debug(`[${this._sessionId}]: Adding ${DIFF_COMPENSATION}msec to tickInterval to compensate for schedule diff (current=${this.diffCompensation}msec)`);
|
|
218
222
|
tickInterval += (DIFF_COMPENSATION / 1000);
|
|
219
223
|
this.diffCompensation -= DIFF_COMPENSATION;
|