Skip to content

Commit 250b5d7

Browse files
committed
fix: ensure pieces don't claim to have durations when their end has not yet been decided
1 parent f4e61fa commit 250b5d7

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

packages/job-worker/src/playout/resolvedPieces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ export function getResolvedPiecesForPartInstancesOnTimeline(
4747

4848
const currentPartStarted = partInstancesInfo.current.partStarted ?? now
4949
const nextPartStarted =
50+
partInstancesInfo.current.partInstance.part.autoNext &&
5051
partInstancesInfo.current.partInstance.part.expectedDuration !== undefined
5152
? currentPartStarted + partInstancesInfo.current.partInstance.part.expectedDuration
5253
: null
5354

5455
// Calculate the next part if needed
5556
let nextResolvedPieces: ResolvedPieceInstance[] = []
56-
if (partInstancesInfo.next && partInstancesInfo.current.partInstance.part.autoNext && nextPartStarted != null) {
57+
if (partInstancesInfo.next && nextPartStarted != null) {
5758
const nowInPart = partInstancesInfo.next.nowInPart
5859
nextResolvedPieces = partInstancesInfo.next.pieceInstances.map((instance) =>
5960
resolvePrunedPieceInstance(nowInPart, instance)

packages/job-worker/src/playout/timeline/part.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ export function transformPartIntoTimeline(
6161
}
6262
break
6363
case IBlueprintPieceType.Normal:
64-
pieceEnable = getPieceEnableInsidePart(pieceInstance, partTimings, parentGroup.id)
64+
pieceEnable = getPieceEnableInsidePart(
65+
pieceInstance,
66+
partTimings,
67+
parentGroup.id,
68+
parentGroup.enable.duration !== undefined || parentGroup.enable.end !== undefined
69+
)
6570
break
6671
default:
6772
assertNever(pieceInstance.piece.pieceType)

packages/job-worker/src/playout/timeline/piece.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export function transformPieceGroupAndObjects(
9090
export function getPieceEnableInsidePart(
9191
pieceInstance: ReadonlyDeep<PieceInstanceWithTimings>,
9292
partTimings: PartCalculatedTimings,
93-
partGroupId: string
93+
partGroupId: string,
94+
partHasEndTime: boolean
9495
): TSR.Timeline.TimelineEnable {
9596
const pieceEnable: TSR.Timeline.TimelineEnable = { ...pieceInstance.piece.enable }
9697
if (typeof pieceEnable.start === 'number') {
@@ -103,7 +104,8 @@ export function getPieceEnableInsidePart(
103104
}
104105
}
105106

106-
if (partTimings.toPartPostroll) {
107+
// If the part has an end time, we can consider post-roll
108+
if (partHasEndTime && partTimings.toPartPostroll) {
107109
if (!pieceEnable.duration) {
108110
// make sure that the control object is shortened correctly
109111
pieceEnable.duration = `#${partGroupId} - ${partTimings.toPartPostroll}`

packages/job-worker/src/playout/timeline/rundown.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ function generateCurrentInfinitePieceObjects(
266266
const pieceEnable = getPieceEnableInsidePart(
267267
pieceInstance,
268268
currentPartInstanceTimings,
269-
timingContext.currentPartGroup.id
269+
timingContext.currentPartGroup.id,
270+
timingContext.currentPartGroup.enable.end !== undefined ||
271+
timingContext.currentPartGroup.enable.duration !== undefined
270272
)
271273

272274
let nowInParent = currentPartInfo.nowInPart // Where is 'now' inside of the infiniteGroup?

0 commit comments

Comments
 (0)