fix decklink-out: init grains_read from current time to avoid epoch realignment

This commit is contained in:
Johanness
2026-05-30 23:13:24 +03:00
parent c2e823beda
commit b5d9c7cd3f
2 changed files with 8 additions and 0 deletions
@@ -226,6 +226,13 @@ void DeckLinkOutNode::process() {
return; 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); auto deadline = mxlIndexToTimestamp(&output_rate_, grains_read_ + 1);
mxlSleepUntil(deadline); mxlSleepUntil(deadline);
@@ -45,6 +45,7 @@ private:
mxlRational output_rate_{50, 1}; mxlRational output_rate_{50, 1};
uint64_t read_index_ = 0; uint64_t read_index_ = 0;
uint64_t grains_read_ = 0; uint64_t grains_read_ = 0;
bool first_frame_ = true;
int device_index_ = 0; int device_index_ = 0;
BMDDisplayMode display_mode_ = bmdModeHD1080i50; BMDDisplayMode display_mode_ = bmdModeHD1080i50;