Add adaptive packet loss handling
This commit is contained in:
@@ -27,6 +27,7 @@ public sealed partial class VoiceCatClient
|
||||
Id = info.Id, ParentId = info.ParentId, Name = info.Name, Topic = info.Topic, MaxUsers = info.MaxUsers, Order = info.SortOrder,
|
||||
Audio = new() { Codec = info.Audio.Codec, Mode = info.Audio.Stereo ? ChannelMode.ModeStereo : ChannelMode.ModeMono, SampleRate = info.Audio.SampleRate,
|
||||
BitrateBps = info.Audio.BitrateBps, FrameMs = info.Audio.FrameMs, Application = (OpusApplication)info.Audio.Application, Complexity = info.Audio.Complexity,
|
||||
Fec = info.Audio.Fec, ExpectedPacketLoss = info.Audio.ExpectedPacketLoss, Dtx = info.Audio.Dtx, Dred = info.Audio.Dred }
|
||||
Fec = info.Audio.Fec, ExpectedPacketLoss = info.Audio.ExpectedPacketLoss, Dtx = info.Audio.Dtx, Dred = info.Audio.Dred,
|
||||
PacketLossMode = (PacketLossMode)info.Audio.PacketLossMode }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Windows-facing state and command values used by the WinForms application.
|
||||
namespace VoiceCat.Windows;
|
||||
|
||||
public enum VcPacketLossMode { Manual, AutoFast, AutoBalanced, AutoStable }
|
||||
|
||||
public enum VcResult
|
||||
{
|
||||
Ok = 0,
|
||||
|
||||
@@ -73,4 +73,5 @@ public sealed record AudioConfigInfo(
|
||||
uint ExpectedPacketLoss,
|
||||
bool Dtx,
|
||||
uint Complexity,
|
||||
bool Dred);
|
||||
bool Dred,
|
||||
VcPacketLossMode PacketLossMode = VcPacketLossMode.Manual);
|
||||
|
||||
@@ -87,6 +87,7 @@ public sealed partial class VoiceCatClient : IDisposable
|
||||
StopDevices(); core.DisconnectAsync().GetAwaiter().GetResult(); return VcResult.Ok;
|
||||
}
|
||||
public string GetServerIdentityDisplay() => core.ServerHello is { } hello ? Convert.ToHexString(hello.ServerIdentityFingerprint.Span) : "";
|
||||
public bool SupportsAdaptivePacketLoss => core.SupportsAdaptivePacketLoss;
|
||||
|
||||
public void PumpEvents()
|
||||
{
|
||||
@@ -182,7 +183,7 @@ public sealed partial class VoiceCatClient : IDisposable
|
||||
public List<DeviceInfo> ListDevices(VcDeviceKind kind) => backend?.Enumerate(kind == VcDeviceKind.Input).Select(d => new DeviceInfo(d.Id, d.Name, d.IsDefault)).ToList() ?? [];
|
||||
public static string VersionString => "VoiceCat managed core 0.1.0 (protocol v2)";
|
||||
public static string ResultString(VcResult result) => result.ToString();
|
||||
private static AudioConfigInfo Audio(AudioConfig a) => new(a.Codec, a.Mode == ChannelMode.ModeStereo, a.SampleRate, a.BitrateBps, a.FrameMs, (uint)a.Application, a.Fec, a.ExpectedPacketLoss, a.Dtx, a.Complexity, a.Dred);
|
||||
private static AudioConfigInfo Audio(AudioConfig a) => new(a.Codec, a.Mode == ChannelMode.ModeStereo, a.SampleRate, a.BitrateBps, a.FrameMs, (uint)a.Application, a.Fec, a.ExpectedPacketLoss, a.Dtx, a.Complexity, a.Dred, (VcPacketLossMode)a.PacketLossMode);
|
||||
|
||||
private void StopDevices()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user