Skip to content

Commit

Permalink
console loges for debugging will be removed when done
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Lautakoksi committed Aug 14, 2023
1 parent b1bbe6c commit 0753ee0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions engine/session_live.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ class SessionLive {
for (let segIdx = 0; segIdx < segments[bw].length; segIdx++) {
const v2lSegment = segments[bw][segIdx];
if (v2lSegment.cue) {
console.log("cue video")
if (v2lSegment.cue["in"]) {
console.log("cue in exists video")
cueInExists = true;
} else {
console.log("cue in does not exists video")
cueInExists = false;
}
}
Expand All @@ -315,11 +318,13 @@ class SessionLive {
if (!segments[bw][endIdx].discontinuity) {
const finalSegItem = { discontinuity: true };
if (!cueInExists) {
console.log(" adding cue in video")
finalSegItem["cue"] = { in: true };
}
this.vodSegments[bw].push(finalSegItem);
} else {
if (!cueInExists) {
console.log(" adding cue in video")
segments[bw][endIdx]["cue"] = { in: true };
}
}
Expand Down Expand Up @@ -365,9 +370,12 @@ class SessionLive {
for (let segIdx = 0; segIdx < segments[groupId][lang].length; segIdx++) {
const v2lSegment = segments[groupId][lang][segIdx];
if (v2lSegment.cue) {
console.log("cue audio")
if (v2lSegment.cue["in"]) {
console.log("cue in exists audio")
cueInExists = true;
} else {
console.log("cue in does not exists audio")
cueInExists = false;
}
}
Expand All @@ -378,11 +386,13 @@ class SessionLive {
if (!segments[groupId][lang][endIdx].discontinuity) {
const finalSegItem = { discontinuity: true };
if (!cueInExists) {
console.log(" adding cue in audio")
finalSegItem["cue"] = { in: true };
}
this.vodAudioSegments[groupId][lang].push(finalSegItem);
} else {
if (!cueInExists) {
console.log(" adding cue in audio")
segments[groupId][lang][endIdx]["cue"] = { in: true };
}
}
Expand Down Expand Up @@ -515,6 +525,7 @@ class SessionLive {
currentMediaSequenceSegments[liveTargetBandwidth] = [];
// In case we switch back before we've depleted all transitional segments
currentMediaSequenceSegments[liveTargetBandwidth] = this.vodSegments[vodTargetBandwidth].concat(this.liveSegQueue[liveTargetBandwidth]);
console.log("adding extra video")
currentMediaSequenceSegments[liveTargetBandwidth].push({ discontinuity: true, cue: { in: true } });
debug(`[${this.sessionId}]: Getting current media segments for bw=${bw}`);
}
Expand Down Expand Up @@ -569,6 +580,7 @@ class SessionLive {
currentAudioSequenceSegments[liveTargetGroupLang.audioGroupId][liveTargetGroupLang.audioLanguage] = [];
// In case we switch back before we've depleted all transitional segments
currentAudioSequenceSegments[liveTargetGroupLang.audioGroupId][liveTargetGroupLang.audioLanguage] = this.vodAudioSegments[vodTargetGroupLang.audioGroupId][vodTargetGroupLang.audioLanguage].concat(this.liveAudioSegQueue[liveTargetGroupLang.audioGroupId][liveTargetGroupLang.audioLanguage]);
console.log("adding extra audio")
currentAudioSequenceSegments[liveTargetGroupLang.audioGroupId][liveTargetGroupLang.audioLanguage].push({ discontinuity: true, cue: { in: true } });
debug(`[${this.sessionId}]: Getting current audio segments for ${groupId, langs[j]}`);
}
Expand Down Expand Up @@ -2063,6 +2075,7 @@ class SessionLive {
if (!cueData) {
cueData = {};
}
console.log("adding live segment to queue")
cueData["in"] = true;
}
if ("cueout" in attributes) {
Expand Down Expand Up @@ -2142,6 +2155,7 @@ class SessionLive {
this.liveAudioSegsForFollowers[liveTargetGroupId][liveTargetLanguage].push({ discontinuity: true });
}
if ("cuein" in attributes) {
console.log("adding live segment to queue")
if (!cueData) {
cueData = {};
}
Expand Down Expand Up @@ -2421,6 +2435,7 @@ class SessionLive {
m3u8 += "#EXT-X-DATERANGE:" + dateRangeAttributes + "\n";
}
// Mimick logic used in hls-vodtolive
//console.log(segment, segment.cue, 2000)
if (segment.cue && segment.cue.in) {
m3u8 += "#EXT-X-CUE-IN" + "\n";
}
Expand Down
2 changes: 2 additions & 0 deletions engine/stream_switcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ class StreamSwitcher {
currVodAudioSegments = this._mergeAudioSegments(prerollAudioSegments, currVodAudioSegments, false);
}
}
console.log(currVodAudioSegments["aac"], "audio")
console.log(currVodSegments, "video")

// In risk that the SL-playhead might have updated some data after
// we reset last time... we should Reset SessionLive before sending new data.
Expand Down

0 comments on commit 0753ee0

Please sign in to comment.