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
+6 -2
View File
@@ -106,6 +106,7 @@ class NDIOutNode : public dmf::NodeBase {
NDIlib_video_frame_v2_t p216_frame{};
p216_frame.xres = width;
p216_frame.yres = height;
p216_frame.FourCC = NDIlib_FourCC_video_type_P216;
p216_frame.frame_rate_N = fps_num;
p216_frame.frame_rate_D = fps_den;
p216_frame.line_stride_in_bytes = width * static_cast<int>(sizeof(uint16_t));
@@ -125,10 +126,13 @@ class NDIOutNode : public dmf::NodeBase {
// --- main loop ---
const mxlRational video_rate = {fps_num, fps_den};
const mxlRational audio_rate = {sample_rate, 1};
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);
}
uint64_t frame_count = 0;
uint64_t invalid_count = 0;
uint64_t late_count = 0;