From 31b57f7a3382966565d4de6db7402ae004330dd7 Mon Sep 17 00:00:00 2001 From: JohannesItten Date: Wed, 1 Jul 2026 13:08:04 +0300 Subject: [PATCH] fix: cast NDI p_data to float* before copying audio samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NDIlib_audio_frame_v3_t.p_data is uint8_t*, not float*. Calling vector::assign(uint8_t*, uint8_t*+N) converted each individual byte (0-255) into a separate float instead of reinterpreting 4 bytes as one float sample — producing complete noise on playback. Co-Authored-By: Claude Sonnet 4.6 --- shared/NDIReceiver.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/NDIReceiver.hpp b/shared/NDIReceiver.hpp index 691acd0..638fcb7 100644 --- a/shared/NDIReceiver.hpp +++ b/shared/NDIReceiver.hpp @@ -177,7 +177,8 @@ public: audio_info.samples = audio_frame.no_samples; audio_info.channel_stride = audio_frame.channel_stride_in_bytes / sizeof(float); const int total = audio_frame.no_channels * audio_info.channel_stride; - audio_out.assign(audio_frame.p_data, audio_frame.p_data + total); + const auto* fdata = reinterpret_cast(audio_frame.p_data); + audio_out.assign(fdata, fdata + total); NDIlib_recv_free_audio_v3(recv_, &audio_frame); return FrameKind::Audio; }