Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/MediaEndPoints.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
Expand Down Expand Up @@ -164,7 +166,7 @@ public struct AudioFormat
public const int DEFAULT_CHANNEL_COUNT = 1;

public static readonly AudioFormat Empty = new AudioFormat()
{ _isNonEmpty = false, ClockRate = DEFAULT_CLOCK_RATE, ChannelCount = DEFAULT_CHANNEL_COUNT };
{ _isNonEmpty = false, ClockRate = DEFAULT_CLOCK_RATE, ChannelCount = DEFAULT_CHANNEL_COUNT };

public AudioCodecsEnum Codec { get; set; }

Expand Down Expand Up @@ -288,7 +290,7 @@ public AudioFormat(int formatID, string formatName, int clockRate, int rtpClockR
{
throw new ApplicationException($"The format name must be provided for an AudioFormat.");
}
else if(clockRate <= 0)
else if (clockRate <= 0)
{
throw new ApplicationException($"The clock rate for an AudioFormat must be greater than 0.");
}
Expand Down Expand Up @@ -329,7 +331,7 @@ public struct VideoFormat
public const int DEFAULT_CLOCK_RATE = 90000;

public static readonly VideoFormat Empty = new VideoFormat()
{ _isNonEmpty = false, ClockRate = DEFAULT_CLOCK_RATE };
{ _isNonEmpty = false, ClockRate = DEFAULT_CLOCK_RATE };

public VideoCodecsEnum Codec { get; set; }

Expand Down Expand Up @@ -544,6 +546,14 @@ public interface IAudioEncoder
/// <returns>A byte array containing the encoded sample.</returns>
byte[] EncodeAudio(short[] pcm, AudioFormat format);

/// <summary>
/// Encodes 16bit signed PCM samples.
/// </summary>
/// <param name="pcm">An array of 16 bit signed audio samples.</param>
/// <param name="format">The audio format to encode the PCM sample to.</param>
/// <param name="destination">A <see cref="IBufferWriter{T}"/> of <see langword="byte"/> to receieve the encoded sample.</param>
void EncodeAudio(ReadOnlySpan<short> pcm, AudioFormat format, IBufferWriter<byte> destination);

/// <summary>
/// Decodes to 16bit signed PCM samples.
/// </summary>
Expand Down Expand Up @@ -649,6 +659,8 @@ public interface IAudioSource
{
event EncodedSampleDelegate OnAudioSourceEncodedSample;

event Action<uint, ReadOnlyMemory<byte>> OnAudioSourceEncodedSampleEx;

event RawAudioSampleDelegate OnAudioSourceRawSample;

event SourceErrorDelegate OnAudioSourceError;
Expand Down
1 change: 1 addition & 0 deletions src/SIPSorceryMedia.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<PackageId>SIPSorceryMedia.Abstractions</PackageId>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Disable warning for missing XML doc comments. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8</TargetFramework>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand All @@ -11,10 +11,6 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -24,6 +20,20 @@
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.19" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\SIPSorceryMedia.Abstractions.csproj" />
</ItemGroup>
Expand Down