Skip to content

Commit 47d5549

Browse files
committed
Fixes audio not working in 6.0
1 parent 79a4ed7 commit 47d5549

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

deployment/VL.IO.NDI.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
33
<metadata>
44
<id>VL.IO.NDI</id>
5-
<version>0.5.3-preview</version>
5+
<version>0.5.4-preview</version>
66
<title>VL.IO.NDI</title>
77
<authors>vvvv, Matthias Husinsky, sebl, NewTek</authors>
88
<owners>vvvv, Matthias Husinsky, sebl, NewTek</owners>

src/Sender.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,19 @@ public unsafe void Send(AudioFrame audioFrame)
252252

253253
if (audioFrame.IsPlanar)
254254
{
255-
var buffer = audioFrame.Data.Span;
256-
fixed (float* bufferPointer = buffer)
255+
// As long as this package needs to run in 5.2 and 6.0 we can't use the Span property as it causes a MissingMethodException
256+
//var buffer = audioFrame.Data.Span;
257+
//fixed (float* bufferPointer = buffer)
258+
var buffer = audioFrame.Data;
259+
using var bufferHandle = buffer.Pin();
257260
fixed (byte* metadataPointer = Utils.StringToUtf8(audioFrame.Metadata))
258261
{
259262
var nativeAudioFrame = new NDIlib.audio_frame_v2_t()
260263
{
261264
channel_stride_in_bytes = buffer.Width * sizeof(float),
262265
no_channels = audioFrame.ChannelCount,
263266
no_samples = audioFrame.SampleCount,
264-
p_data = new IntPtr(bufferPointer),
267+
p_data = new IntPtr(bufferHandle.Pointer),
265268
p_metadata = new IntPtr(metadataPointer),
266269
sample_rate = audioFrame.SampleRate
267270
};

0 commit comments

Comments
 (0)