eyevinn-channel-engine 3.1.2 → 3.1.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/engine/session.js +8 -21
- package/engine/session_live.js +4 -1
- package/package.json +1 -1
package/engine/session.js
CHANGED
|
@@ -395,21 +395,10 @@ class Session {
|
|
|
395
395
|
if (!this._sessionState) {
|
|
396
396
|
throw new Error('Session not ready');
|
|
397
397
|
}
|
|
398
|
-
const sessionState = await this._sessionState.getValues(["
|
|
398
|
+
const sessionState = await this._sessionState.getValues(["discSeq"]);
|
|
399
399
|
const playheadState = await this._playheadState.getValues(["mediaSeq", "vodMediaSeqVideo"]);
|
|
400
400
|
|
|
401
|
-
|
|
402
|
-
Since sessionState is always newer. If it is a smaller value, then this signals that
|
|
403
|
-
a new vod has been loaded but playheadState has yet to get the new mseq value in 'incrementAsync()'.
|
|
404
|
-
Without this, we risk returning an m3u8 with an old mseq on a new vod to the client.
|
|
405
|
-
*/
|
|
406
|
-
if (playheadState.vodMediaSeqVideo > sessionState.vodMediaSeqVideo) {
|
|
407
|
-
playheadState.vodMediaSeqVideo = sessionState.vodMediaSeqVideo;
|
|
408
|
-
playheadState.mediaSeq = sessionState.mediaSeq;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (playheadState.vodMediaSeqVideo === 0 || this.waitingForNextVod) {
|
|
412
|
-
this.waitingForNextVod = false;
|
|
401
|
+
if (playheadState.vodMediaSeqVideo === 0) {
|
|
413
402
|
const isLeader = await this._sessionStateStore.isLeader(this._instanceId);
|
|
414
403
|
if (!isLeader) {
|
|
415
404
|
debug(`[${this._sessionId}]: Not a leader and first media sequence in a VOD is requested. Invalidate cache to ensure having the correct VOD.`);
|
|
@@ -466,14 +455,6 @@ class Session {
|
|
|
466
455
|
let sessionState = await this._sessionState.getValues(
|
|
467
456
|
["state", "mediaSeq", "discSeq", "vodMediaSeqVideo", "vodMediaSeqAudio"]);
|
|
468
457
|
let playheadState = await this._playheadState.getValues(["mediaSeq", "vodMediaSeqVideo", "vodMediaSeqAudio"]);
|
|
469
|
-
if (playheadState.vodMediaSeqVideo < 2) {
|
|
470
|
-
// This is due to the possibility that we miss the tick where vodMediaSeqVideo is 0
|
|
471
|
-
// The worst case scenario is that we clear cache two times in a row on a switch
|
|
472
|
-
if (!isLeader) {
|
|
473
|
-
debug(`[${this._sessionId}]: Not a leader and first media sequence in a VOD is requested. Invalidate cache to ensure having the correct VOD.`);
|
|
474
|
-
await this._sessionState.clearCurrentVodCache(); // force reading up from shared store
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
458
|
let currentVod = await this._sessionState.getCurrentVod();
|
|
478
459
|
if (!currentVod ||
|
|
479
460
|
sessionState.vodMediaSeqVideo === null ||
|
|
@@ -518,6 +499,12 @@ class Session {
|
|
|
518
499
|
debug(`[${this._sessionId}]: INCREMENT (mseq=${playheadState.mediaSeq + playheadState.vodMediaSeqVideo}) vodMediaSeq=(${playheadState.vodMediaSeqVideo}_${playheadState.vodMediaSeqAudio} of ${currentVod.getLiveMediaSequencesCount()})`);
|
|
519
500
|
let m3u8 = currentVod.getLiveMediaSequences(playheadState.mediaSeq, 180000, playheadState.vodMediaSeqVideo, sessionState.discSeq);
|
|
520
501
|
await this._playheadState.setLastM3u8(m3u8);
|
|
502
|
+
|
|
503
|
+
if (!isLeader && playheadState.vodMediaSeqVideo < 2) {
|
|
504
|
+
debug(`[${this._sessionId}]: Not a leader and have just set playheadState vodMediaSeqVideo to 0|1. Invalidate cache to ensure having the correct VOD.`);
|
|
505
|
+
await this._sessionState.clearCurrentVodCache();
|
|
506
|
+
}
|
|
507
|
+
|
|
521
508
|
return m3u8;
|
|
522
509
|
}
|
|
523
510
|
|
package/engine/session_live.js
CHANGED
|
@@ -247,7 +247,7 @@ class SessionLive {
|
|
|
247
247
|
if (!this.vodSegments[bw]) {
|
|
248
248
|
this.vodSegments[bw] = [];
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
if (segments[bw][0].discontinuity) {
|
|
252
252
|
segments[bw].shift();
|
|
253
253
|
}
|
|
@@ -644,6 +644,9 @@ class SessionLive {
|
|
|
644
644
|
// Wait a little before trying again
|
|
645
645
|
debug(`[${this.sessionId}]: ALERT! Live Source Data NOT in sync! Will try again after ${retryDelayMs}ms`);
|
|
646
646
|
await timer(retryDelayMs);
|
|
647
|
+
if (isLeader) {
|
|
648
|
+
this.timerCompensation = false;
|
|
649
|
+
}
|
|
647
650
|
continue;
|
|
648
651
|
}
|
|
649
652
|
|