Skip to content

fix: previousPartKeepaliveDuration calculations#1665

Draft
imaretic wants to merge 1 commit intoSofie-Automation:mainfrom
evs-broadcast:contribute/previousPartKeepaliveDuration-calculations
Draft

fix: previousPartKeepaliveDuration calculations#1665
imaretic wants to merge 1 commit intoSofie-Automation:mainfrom
evs-broadcast:contribute/previousPartKeepaliveDuration-calculations

Conversation

@imaretic
Copy link
Contributor

@imaretic imaretic commented Feb 25, 2026

About the Contributor

This PR is posted on behalf of EVS Broadcast Equipment.

Type of Contribution

This is a: Bug fix

Current Behavior

When a part is defined with inTransition and previousPartKeepaliveDuration, the timing calculations behave inconsistently.

  1. Part's expectedDurationWithTransition calculation:

    • This property is reduced by the value of previousPartKeepaliveDuration.
    • This shortened duration is also reflected in the UI.
  2. Playout duration of the previous part:

    • The total played duration of the previous part is shortened by next part's previousPartKeepaliveDuration.
    • Visually, the part appears to end earlier than expected.

This behavior also does not match expected durations in interactive demo as described on "Part and Piece Timings" documentation page.

New Behavior

This PR adjusts the timing calculations:

  1. Part's expectedDurationWithTransition is no longer reduced by the value of previousPartKeepaliveDuration.
  2. Playout timing now takes next part's previousPartKeepaliveDuration into account when determining the part’s group enable timing.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

This PR affects the timing calculation in the Rundown during playout.

Time Frame

Not urgent, but we would like to get this merged into the in-development release.

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

Summary

This PR fixes timing calculations for parts with inTransition and previousPartKeepaliveDuration set, addressing inconsistencies in rundown playout timing.

Changes

packages/corelib/src/playout/timings.ts

  • Updated calculateExpectedDurationWithTransition to subtract fromPartKeepalive from the timing calculation alongside existing subtractions (toPartDelay, fromPartPostroll)
  • Modified the calculation from (fromPartRemaining - toPartDelay - fromPartPostroll) to (fromPartRemaining - toPartDelay - fromPartPostroll - fromPartKeepalive)
  • Updated the associated comment to reflect that keepalive contributes to fromPartRemaining and therefore must be excluded from the expected duration reduction

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

  • Refactored createCurrentPartGroupEnable function signature to accept nextPartInfo: SelectedPartInstanceTimelineInfo | undefined instead of a boolean hasNextPart parameter
  • Updated the call site in buildTimelineObjsForRundown to pass partInstancesInfo.next directly instead of a boolean
  • Modified the autonext duration calculation to include nextPartInfo.calculatedTimings.fromPartRemaining, which extends the current part's duration to account for the next part's overlap/keepalive window
  • Preserved all other autonext criteria checks (autoNext and expectedDuration defined)

These changes ensure that timing display in the UI correctly reflects the actual playout behavior and aligns with the interactive timings demo documentation.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/corelib/src/playout/timings.ts 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@imaretic imaretic added the Contribution from EVS Contributions sponsored by EVS Broadcast Equipment (evs.com) label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from EVS Contributions sponsored by EVS Broadcast Equipment (evs.com)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant