Skip to content

Commit 8943fa0

Browse files
committed
fix: queuedSegmentId ignored when taking last part of the rundown
1 parent a241e02 commit 8943fa0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/job-worker/src/playout/__tests__/selectNextPart.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,11 @@ describe('selectNextPart', () => {
418418
expect(nextPart).toEqual({ index: 6, part: defaultParts[6], consumesQueuedSegmentId: false })
419419
}
420420
})
421+
422+
test('on last part, with queued segment', () => {
423+
// On the last part in the rundown, with a queuedSegment id set to earlier
424+
defaultPlaylist.queuedSegmentId = segment2
425+
const nextPart = selectNextPart2(defaultParts[8].toPartInstance(), defaultParts[8].toPartInstance())
426+
expect(nextPart).toEqual({ index: 4, part: defaultParts[4], consumesQueuedSegmentId: true })
427+
})
421428
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function selectNextPart(
173173

174174
if (rundownPlaylist.queuedSegmentId) {
175175
// No previous part, or segment has changed
176-
if (!previousPartInstance || (nextPart && previousPartInstance.segmentId !== nextPart.part.segmentId)) {
176+
if (!previousPartInstance || !nextPart || previousPartInstance.segmentId !== nextPart.part.segmentId) {
177177
// Find first in segment
178178
const newSegmentPart = findFirstPlayablePart(
179179
0,

0 commit comments

Comments
 (0)