From b5d9c7cd3ff392151bccc4f387e2fdb26c6254cf Mon Sep 17 00:00:00 2001 From: Johanness Date: Sat, 30 May 2026 23:13:24 +0300 Subject: [PATCH] fix decklink-out: init grains_read from current time to avoid epoch realignment --- nodes/decklink-out/src/decklink_out_node.cpp | 7 +++++++ nodes/decklink-out/src/decklink_out_node.hpp | 1 + 2 files changed, 8 insertions(+) diff --git a/nodes/decklink-out/src/decklink_out_node.cpp b/nodes/decklink-out/src/decklink_out_node.cpp index e51a641..d836a9b 100644 --- a/nodes/decklink-out/src/decklink_out_node.cpp +++ b/nodes/decklink-out/src/decklink_out_node.cpp @@ -226,6 +226,13 @@ void DeckLinkOutNode::process() { return; } + if (first_frame_) { + auto now = mxlGetTime(); + grains_read_ = mxlTimestampToIndex(&output_rate_, now); + first_frame_ = false; + spdlog::info("DeckLink-out: starting at output index {}", grains_read_); + } + auto deadline = mxlIndexToTimestamp(&output_rate_, grains_read_ + 1); mxlSleepUntil(deadline); diff --git a/nodes/decklink-out/src/decklink_out_node.hpp b/nodes/decklink-out/src/decklink_out_node.hpp index ea0ec26..1dbcf8a 100644 --- a/nodes/decklink-out/src/decklink_out_node.hpp +++ b/nodes/decklink-out/src/decklink_out_node.hpp @@ -45,6 +45,7 @@ private: mxlRational output_rate_{50, 1}; uint64_t read_index_ = 0; uint64_t grains_read_ = 0; + bool first_frame_ = true; int device_index_ = 0; BMDDisplayMode display_mode_ = bmdModeHD1080i50;