fix: set p216_frame FourCC; scope audio_rate to has_audio branch

ndiout: p216_frame.FourCC was zero-initialized — NDI needs it explicitly
set to NDIlib_FourCC_video_type_P216 to send the correct format.

All three nodes: audio_rate = {sample_rate, 1} was always declared even
when has_audio is false (sample_rate = 0 in ndiout). Scoped into the
has_audio block so the bad rate can never be passed to mxlGetCurrentIndex.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
JohannesItten
2026-07-03 10:01:39 +03:00
parent 2a5d3758b6
commit 2b11411423
3 changed files with 16 additions and 6 deletions
+5 -2
View File
@@ -65,7 +65,6 @@ class TestPatternNode : public dmf::NodeBase {
// --- main loop ---
const mxlRational video_rate = {fps_num, fps_den};
const mxlRational audio_rate = {sample_rate, 1};
const size_t samples_per_frame =
static_cast<size_t>(sample_rate) * static_cast<size_t>(fps_den) / static_cast<size_t>(fps_num);
@@ -73,7 +72,11 @@ class TestPatternNode : public dmf::NodeBase {
const float amplitude = static_cast<float>(std::pow(10.0, -18.0 / 20.0));
uint64_t video_index = mxlGetCurrentIndex(&video_rate);
uint64_t audio_index = has_audio ? mxlGetCurrentIndex(&audio_rate) : 0;
uint64_t audio_index = 0;
if (has_audio) {
const mxlRational audio_rate = {sample_rate, 1};
audio_index = mxlGetCurrentIndex(&audio_rate);
}
log("start video_index=%llu", video_index);
while (dmf::g_running.load(std::memory_order_relaxed)) {