Skip to content

Commit d096f6f

Browse files
committed
Merge remote-tracking branch 'bbc/upstream/set-next-from-here' into nrk/test/set-next-from-here
2 parents 3122f23 + 5766554 commit d096f6f

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

packages/job-worker/src/playout/lookahead/findForLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function generatePartInstanceLookaheads(
115115
): { objs: LookaheadTimelineObject[]; partInfo: PartAndPieces } {
116116
const partInfo: PartAndPieces = {
117117
part: partInstanceInfo.part.part,
118-
usesInTransition: partInstanceInfo.calculatedTimings?.inTransitionStart ? true : false,
118+
usesInTransition: partInstanceInfo.calculatedTimings?.inTransitionStart !== null ? true : false,
119119
pieces: sortPieceInstancesByStart(partInstanceInfo.allPieces, partInstanceInfo.nowInPart),
120120
}
121121
if (nextTimeOffset) {

packages/job-worker/src/playout/lookahead/findObjects.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ export function findLookaheadObjectsForPart(
105105
for (const rawPiece of partInfo.pieces) {
106106
if (shouldIgnorePiece(partInfo, rawPiece)) continue
107107

108-
const obj = getObjectMapForPiece(rawPiece).get(layer)
108+
const rawObj = getObjectMapForPiece(rawPiece).get(layer)
109+
const obj = rawObj ? structuredClone(rawObj) : undefined
109110

110111
// we only consider lookahead objects for lookahead and calculate the lookaheadOffset for each object.
111112
const computedLookaheadObj = computeLookaheadObject(obj, rawPiece, partInfo, partInstanceId, nextTimeOffset)
@@ -131,7 +132,14 @@ export function findLookaheadObjectsForPart(
131132
if (allObjs.length === 1) {
132133
// Only one, just return it
133134
const obj = allObjs[0]
134-
const patchedContent = tryActivateKeyframesForObject(obj, !!transitionPiece, classesFromPreviousPart)
135+
const patchedContent = tryActivateKeyframesForObject(
136+
{
137+
...obj,
138+
content: structuredClone(obj.content),
139+
},
140+
!!transitionPiece,
141+
classesFromPreviousPart
142+
)
135143

136144
return [
137145
{
@@ -144,7 +152,7 @@ export function findLookaheadObjectsForPart(
144152

145153
const res: Array<LookaheadTimelineObject> = []
146154
allObjs.map((obj) => {
147-
const piece = partInfo.pieces.find((piece) => unprotectString(piece._id) === obj.pieceInstanceId)
155+
const piece = partInfo.pieces.find((piece) => unprotectString(piece._id) === getBestPieceInstanceId(piece))
148156
if (!piece) return
149157

150158
// If there is a transition and this piece is abs0, it is assumed to be the primary piece and so does not need lookahead
@@ -158,7 +166,14 @@ export function findLookaheadObjectsForPart(
158166
}
159167

160168
if (obj) {
161-
const patchedContent = tryActivateKeyframesForObject(obj, !!transitionPiece, classesFromPreviousPart)
169+
const patchedContent = tryActivateKeyframesForObject(
170+
{
171+
...obj,
172+
content: structuredClone(obj.content),
173+
},
174+
!!transitionPiece,
175+
classesFromPreviousPart
176+
)
162177

163178
res.push(
164179
literal<LookaheadTimelineObject>({

0 commit comments

Comments
 (0)