fix: NDI node correctness and robustness fixes

NDIHelper:
- find_sources: check g_running each attempt to avoid 50s block on shutdown
- getV210_video_frame: fix P216 branch (fall-through + local pointer reassignment bug)
- getV210_video_frame: status_change re-queries source info instead of throwing
- select_source: fix typo "recieve" → "receive"

ndiout:
- set frame_rate_N/frame_rate_D on the NDI send frame (was 0/0)
- add per-second stats logging (matching fakesink pattern)
- add missing <chrono> include
- fix typo "reciever" → "receiver"

ndiin:
- read source_num from NODE_CONFIG (key: "source_num", default 0)
- wrap hot-loop NDI call in try/catch so source-lost terminates cleanly
- pass source_num through to getV210_video_frame

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
JohannesItten
2026-07-01 12:07:45 +03:00
parent 19ea14a61c
commit 7a32fa20af
3 changed files with 60 additions and 34 deletions
+10 -6
View File
@@ -10,15 +10,15 @@
class NDIInNode : public dmf::NodeBase {
void run() override {
const uint32_t source_num = config().value("source_num", 0);
dmf::NDIHelper ndi_helper;
try {
std::vector<std::string> ndi_sources;
ndi_helper.find_sources(&ndi_sources, 5000);
log("Available NDI sources:");
for (const auto& source_name : ndi_sources){
log("%s", source_name.c_str());
}
uint32_t source_num = 0;
for (const auto& source_name : ndi_sources)
log(" %s", source_name.c_str());
ndi_helper.select_source(source_num);
ndi_helper.get_source_info(source_num);
} catch (const std::runtime_error& e) {
@@ -63,8 +63,12 @@ class NDIInNode : public dmf::NodeBase {
bool last_ndi_frame_valid = false;
while (dmf::g_running.load(std::memory_order_relaxed)) {
if (ndi_helper.getV210_video_frame(0, latest_buffer, stride)) {
last_ndi_frame_valid = true;
try {
if (ndi_helper.getV210_video_frame(source_num, latest_buffer, stride))
last_ndi_frame_valid = true;
} catch (const std::runtime_error& e) {
log("NDI error: %s — stopping", e.what());
break;
}
uint8_t* buf = nullptr;