Skip to content

Commit

Permalink
Merge pull request #1330 from bbc/upstream/fix-queued-segment-when-on…
Browse files Browse the repository at this point in the history
…-last-part

fix: `queuedSegmentId` ignored when taking last part of the rundown
  • Loading branch information
jstarpl authored Nov 26, 2024
2 parents cc866ca + d7a216d commit 89ddacf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,11 @@ describe('selectNextPart', () => {
expect(nextPart).toEqual({ index: 6, part: defaultParts[6], consumesQueuedSegmentId: false })
}
})

test('on last part, with queued segment', () => {
// On the last part in the rundown, with a queuedSegment id set to earlier
defaultPlaylist.queuedSegmentId = segment2
const nextPart = selectNextPart2(defaultParts[8].toPartInstance(), defaultParts[8].toPartInstance())
expect(nextPart).toEqual({ index: 4, part: defaultParts[4], consumesQueuedSegmentId: true })
})
})
2 changes: 1 addition & 1 deletion packages/job-worker/src/playout/selectNextPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function selectNextPart(

if (rundownPlaylist.queuedSegmentId) {
// No previous part, or segment has changed
if (!previousPartInstance || (nextPart && previousPartInstance.segmentId !== nextPart.part.segmentId)) {
if (!previousPartInstance || !nextPart || previousPartInstance.segmentId !== nextPart.part.segmentId) {
// Find first in segment
const newSegmentPart = findFirstPlayablePart(
0,
Expand Down

0 comments on commit 89ddacf

Please sign in to comment.