Skip to content

Commit

Permalink
fix: diffcompensation on reload and tidy up (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfrederiksen authored Oct 25, 2024
1 parent f5c2e34 commit b511e37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions engine/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ class Session {
await this._sessionState.remove("nextVod");
this.leaderIsSettingNextVod = false;
await this._playheadState.set("diffCompensation", this.diffCompensation, isLeader);
debug(`[${this._sessionId}]: sharing durrent vods diffCompensation=${this.diffCompensation}`);
debug(`[${this._sessionId}]: sharing current vods diffCompensation=${this.diffCompensation}`);
this.produceEvent({
type: 'NOW_PLAYING',
data: {
Expand Down Expand Up @@ -1574,8 +1574,8 @@ class Session {
case SessionState.VOD_RELOAD_INIT:
try {
debug(`[${this._sessionId}]: state=VOD_RELOAD_INIT`);
if (this.diffCompensation !== 0) {
this.diffCompensation = 0;
if (this.diffCompensation <= 0) {
this.diffCompensation = 0.1;
}
if (isLeader) {
const startTS = Date.now();
Expand Down
4 changes: 2 additions & 2 deletions engine/session_live.js
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ class SessionLive {
}

_pushToQueue(seg, liveTargetBandwidth, logName) {
const liveSegURIs = this.liveSegQueue[liveTargetBandwidth].filter((seg) => seg.uri).map((seg) => seg.uri);
const liveSegURIs = this.liveSegQueue[liveTargetBandwidth].filter((seg) => seg.uri).map((seg) => seg.uri).slice(-2);
if (seg.uri && liveSegURIs.includes(seg.uri)) {
debug(`[${this.sessionId}]: ${logName}: Found duplicate live segment. Skip push! (${liveTargetBandwidth})`);
} else {
Expand All @@ -2168,7 +2168,7 @@ class SessionLive {
}

_pushToQueueAudio(seg, liveTargetAudiotrack, logName) {
const liveSegURIs = this.liveSegQueueAudio[liveTargetAudiotrack].filter((seg) => seg.uri).map((seg) => seg.uri);
const liveSegURIs = this.liveSegQueueAudio[liveTargetAudiotrack].filter((seg) => seg.uri).map((seg) => seg.uri).slice(-2);
if (seg.uri && liveSegURIs.includes(seg.uri)) {
debug(`[${this.sessionId}]: ${logName}: Found duplicate live segment. Skip push! track -> (${liveTargetAudiotrack})`);
} else {
Expand Down

0 comments on commit b511e37

Please sign in to comment.