eyevinn-channel-engine 3.1.1 → 3.1.2

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.
@@ -18,6 +18,7 @@ const daterangeAttribute = (key, attr) => {
18
18
  const TARGET_PLAYLIST_DURATION_SEC = 60;
19
19
  const RESET_DELAY = 5000;
20
20
  const FAIL_TIMEOUT = 4000;
21
+ const DEFAULT_PLAYHEAD_INTERVAL_MS = 6 * 1000;
21
22
  const PlayheadState = Object.freeze({
22
23
  RUNNING: 1,
23
24
  STOPPED: 2,
@@ -40,7 +41,6 @@ class SessionLive {
40
41
  this.mediaManifestURIs = {};
41
42
  this.liveSegQueue = {};
42
43
  this.lastRequestedMediaSeqRaw = null;
43
- this.targetNumSeg = 0;
44
44
  this.liveSourceM3Us = {};
45
45
  this.playheadState = PlayheadState.IDLE;
46
46
  this.liveSegsForFollowers = {};
@@ -117,7 +117,6 @@ class SessionLive {
117
117
  this.mediaManifestURIs = {};
118
118
  this.liveSegQueue = {};
119
119
  this.lastRequestedMediaSeqRaw = null;
120
- this.targetNumSeg = 0;
121
120
  this.liveSourceM3Us = {};
122
121
  this.liveSegsForFollowers = {};
123
122
  this.timerCompensation = null;
@@ -149,13 +148,6 @@ class SessionLive {
149
148
  return;
150
149
  }
151
150
 
152
- // Let the playhead move at an interval set according to live segment duration
153
- let liveSegmentDurationMs = 6000;
154
- let liveBws = Object.keys(this.liveSegQueue);
155
- if (liveBws.length !== 0 && this.liveSegQueue[liveBws[0]].length !== 0 && this.liveSegQueue[liveBws[0]][0].duration) {
156
- liveSegmentDurationMs = this.liveSegQueue[liveBws[0]][0].duration * 1000;
157
- }
158
-
159
151
  // Fetch Live-Source Segments, and get ready for on-the-fly manifest generation
160
152
  // And also compensate for processing time
161
153
 
@@ -165,6 +157,13 @@ class SessionLive {
165
157
  const tsIncrementEnd = Date.now();
166
158
  this.waitForPlayhead = false;
167
159
 
160
+ // Let the playhead move at an interval set according to live segment duration
161
+ let liveSegmentDurationMs = DEFAULT_PLAYHEAD_INTERVAL_MS;
162
+ let liveBws = Object.keys(this.liveSegQueue);
163
+ if (liveBws.length !== 0 && this.liveSegQueue[liveBws[0]].length !== 0 && this.liveSegQueue[liveBws[0]][0].duration) {
164
+ liveSegmentDurationMs = this.liveSegQueue[liveBws[0]][0].duration * 1000;
165
+ }
166
+
168
167
  // Set the timer
169
168
  let timerValueMs = 0;
170
169
  if (this.timerCompensation) {
@@ -242,7 +241,6 @@ class SessionLive {
242
241
  }
243
242
  // Make it possible to add & share new segments
244
243
  this.allowedToSet = true;
245
- let segCount = 0;
246
244
  const allBws = Object.keys(segments);
247
245
  for (let i = 0; i < allBws.length; i++) {
248
246
  const bw = allBws[i];
@@ -264,12 +262,6 @@ class SessionLive {
264
262
  }
265
263
  }
266
264
 
267
- for (let segIdx = 0; segIdx < segments[allBws[0]].length; segIdx++) {
268
- if (segments[allBws[0]][segIdx].uri) {
269
- segCount++;
270
- }
271
- }
272
- this.targetNumSeg = segCount;
273
265
  debug(`[${this.sessionId}]: Setting CurrentMediaSequenceSegments. First seg is: [${this.vodSegments[allBws[0]][0].uri}]`);
274
266
 
275
267
  const isLeader = await this.sessionLiveStateStore.isLeader(this.instanceId);
@@ -652,7 +644,6 @@ class SessionLive {
652
644
  // Wait a little before trying again
653
645
  debug(`[${this.sessionId}]: ALERT! Live Source Data NOT in sync! Will try again after ${retryDelayMs}ms`);
654
646
  await timer(retryDelayMs);
655
- this.timerCompensation = false;
656
647
  continue;
657
648
  }
658
649
 
@@ -690,14 +681,6 @@ class SessionLive {
690
681
  const transitSegs = await this.sessionLiveState.get("transitSegs");
691
682
  if (!this._isEmpty(transitSegs)) {
692
683
  this.vodSegments = transitSegs;
693
- let discTagCount = 0;
694
- const allBws = Object.keys(this.vodSegments);
695
- for (let segIdx = 0; segIdx < this.vodSegments[allBws[0]].length; segIdx++) {
696
- if (this.vodSegments[allBws[0]][segIdx].discontinuity) {
697
- discTagCount++;
698
- }
699
- }
700
- this.targetNumSeg = this.vodSegments[allBws[0]].length - (discTagCount - 1);
701
684
  }
702
685
  }
703
686
 
@@ -713,14 +696,6 @@ class SessionLive {
713
696
  //debug(`[${this.sessionId}]: NEW FOLLOWER: I tried to get 'transitSegs'. This is what I found ${JSON.stringify(transitSegs)}`);
714
697
  if (!this._isEmpty(transitSegs)) {
715
698
  this.vodSegments = transitSegs;
716
- let discTagCount = 0;
717
- const allBws = Object.keys(this.vodSegments);
718
- for (let segIdx = 0; segIdx < this.vodSegments[allBws[0]].length; segIdx++) {
719
- if (this.vodSegments[allBws[0]][segIdx].discontinuity) {
720
- discTagCount++;
721
- }
722
- }
723
- this.targetNumSeg = this.vodSegments[allBws[0]].length - (discTagCount - 1);
724
699
  }
725
700
  }
726
701
  debug(`[${this.sessionId}]: ...pushAmount=${this.pushAmount}`);
@@ -1131,7 +1106,7 @@ class SessionLive {
1131
1106
  }
1132
1107
  // Push new Live Segments!
1133
1108
  this.liveSegQueue[liveTargetBandwidth].push(seg);
1134
- this.liveSegsForFollowers[liveTargetBandwidth].push(seg);
1109
+ this.liveSegsForFollowers[liveTargetBandwidth].push(seg);
1135
1110
  }
1136
1111
  }
1137
1112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {