decklink-out: add mode support check, limit CreateVideoFrame error spam

This commit is contained in:
Johanness
2026-05-30 23:18:02 +03:00
parent b4f766fb9d
commit a3cd45cc49
2 changed files with 24 additions and 4 deletions
+22 -3
View File
@@ -126,6 +126,20 @@ bool DeckLinkOutNode::open_device() {
callback_ = std::make_unique<OutputCallback>(*this);
output_->SetScheduledFrameCompletionCallback(callback_.get());
{
BMDDisplayMode actual_mode = bmdModeUnknown;
bool supported = false;
auto hr = output_->DoesSupportVideoMode(bmdVideoConnectionUnspecified, display_mode_, bmdFormat10BitYUV,
bmdNoVideoOutputConversion, bmdSupportedVideoModeDefault, &actual_mode, &supported);
if (hr == S_OK) {
spdlog::info("DeckLink-out: mode 0x{:x} V210 supported={} actual=0x{:x}",
static_cast<uint32_t>(display_mode_), supported, static_cast<uint32_t>(actual_mode));
if (!supported) {
spdlog::error("DeckLink-out: display mode not supported for V210 output");
}
}
}
if (output_->EnableVideoOutput(display_mode_, bmdVideoOutputFlagDefault) != S_OK) {
spdlog::error("DeckLink-out: failed to enable video output");
return false;
@@ -189,17 +203,22 @@ void DeckLinkOutNode::schedule_frame(void* mxl_payload, long width, long height,
int32_t out_row_bytes = 0;
HRESULT row_hr = output_->RowBytesForPixelFormat(bmdFormat10BitYUV, width, &out_row_bytes);
if (row_hr != S_OK || out_row_bytes <= 0) {
spdlog::warn("DeckLink-out: RowBytesForPixelFormat failed hr=0x{:08x}, using fallback", static_cast<uint32_t>(row_hr));
spdlog::warn("DeckLink-out: RowBytesForPixelFormat failed hr=0x{:08x}", static_cast<uint32_t>(row_hr));
out_row_bytes = ((width + 5) / 6) * 16;
}
spdlog::debug("DeckLink-out: creating frame {}x{} row_bytes={}", width, height, out_row_bytes);
IDeckLinkMutableVideoFrame* frame = nullptr;
HRESULT hr = output_->CreateVideoFrame(width, height, out_row_bytes, bmdFormat10BitYUV,
bmdFrameFlagDefault, &frame);
if (hr != S_OK || !frame) {
spdlog::warn("DeckLink-out: failed to create output frame {}x{} row_bytes={} hr=0x{:08x}",
if (create_fail_count_ < 5) {
spdlog::error("DeckLink-out: CreateVideoFrame {}x{} row_bytes={} fmt=V210 hr=0x{:08x}",
width, height, out_row_bytes, static_cast<uint32_t>(hr));
create_fail_count_++;
}
if (create_fail_count_ == 5) {
spdlog::error("DeckLink-out: suppressing further CreateVideoFrame errors");
}
return;
}
@@ -57,6 +57,7 @@ private:
BMDTimeScale time_scale_ = 50000;
std::atomic<bool> playing_{false};
int create_fail_count_ = 0;
bool is_interlaced_ = false;
long out_width_ = 1920;
long out_height_ = 1080;