Skip to content

Commit

Permalink
Fixes audio not working in 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
azeno committed Mar 22, 2024
1 parent 79a4ed7 commit 47d5549
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deployment/VL.IO.NDI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>VL.IO.NDI</id>
<version>0.5.3-preview</version>
<version>0.5.4-preview</version>
<title>VL.IO.NDI</title>
<authors>vvvv, Matthias Husinsky, sebl, NewTek</authors>
<owners>vvvv, Matthias Husinsky, sebl, NewTek</owners>
Expand Down
9 changes: 6 additions & 3 deletions src/Sender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,19 @@ public unsafe void Send(AudioFrame audioFrame)

if (audioFrame.IsPlanar)
{
var buffer = audioFrame.Data.Span;
fixed (float* bufferPointer = buffer)
// 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
//var buffer = audioFrame.Data.Span;
//fixed (float* bufferPointer = buffer)
var buffer = audioFrame.Data;
using var bufferHandle = buffer.Pin();
fixed (byte* metadataPointer = Utils.StringToUtf8(audioFrame.Metadata))
{
var nativeAudioFrame = new NDIlib.audio_frame_v2_t()
{
channel_stride_in_bytes = buffer.Width * sizeof(float),
no_channels = audioFrame.ChannelCount,
no_samples = audioFrame.SampleCount,
p_data = new IntPtr(bufferPointer),
p_data = new IntPtr(bufferHandle.Pointer),
p_metadata = new IntPtr(metadataPointer),
sample_rate = audioFrame.SampleRate
};
Expand Down

0 comments on commit 47d5549

Please sign in to comment.