From beb524e95038be2d0cd20be2458c96058f576ef7 Mon Sep 17 00:00:00 2001 From: Lieven Paulissen Date: Wed, 11 Oct 2023 10:12:19 +0200 Subject: [PATCH] ndisrc: Assume input with more than 8 raw audio channels is unpositioned gst_audio_channel_positions_from_mask() will otherwise print warnings all the time. Fixes #444 Part-of: --- net/ndi/src/ndisrc/receiver.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/ndi/src/ndisrc/receiver.rs b/net/ndi/src/ndisrc/receiver.rs index 1a85a3ef..7a616a0c 100644 --- a/net/ndi/src/ndisrc/receiver.rs +++ b/net/ndi/src/ndisrc/receiver.rs @@ -1615,10 +1615,12 @@ impl Receiver { if [NDIlib_FourCC_audio_type_FLTp].contains(&fourcc) { let channels = audio_frame.no_channels() as u32; let mut positions = [gst_audio::AudioChannelPosition::None; 64]; - let _ = gst_audio::AudioChannelPosition::positions_from_mask( - gst_audio::AudioChannelPosition::fallback_mask(channels), - &mut positions[..channels as usize], - ); + if channels <= 8 { + let _ = gst_audio::AudioChannelPosition::positions_from_mask( + gst_audio::AudioChannelPosition::fallback_mask(channels), + &mut positions[..channels as usize], + ); + } let builder = gst_audio::AudioInfo::builder( gst_audio::AUDIO_FORMAT_F32,