Fix audio clock drift and adaptive jitter buffering
.NET port / test (macos-latest) (push) Canceled after 0s
.NET port / test (ubuntu-24.04) (push) Canceled after 0s
.NET port / test (windows-latest) (push) Canceled after 0s
.NET port / apple-client (push) Canceled after 0s

This commit is contained in:
2026-09-20 16:26:03 +02:00
parent 3ee0df11a9
commit dd811a0bb8
23 changed files with 401 additions and 61 deletions
@@ -8,7 +8,7 @@ namespace VoiceCat.iOS;
internal sealed class IosAudioEngine
{
internal static IosAudioEngine Shared { get; } = new();
private readonly PcmRing playbackRing = new(131_072);
private readonly AdaptivePcmBuffer playbackRing = new(2, capacityFrames: 65_536);
private readonly short[] renderScratch = new short[16_384];
private AVAudioEngine? engine;
private AVAudioSourceNode? source;
@@ -28,6 +28,7 @@ internal sealed class IosAudioEngine
private bool inputProvided;
private bool tapInstalled;
internal bool IsConnected { get; private set; }
internal int BufferMilliseconds { get => playbackRing.BufferMilliseconds; set => playbackRing.BufferMilliseconds = value; }
private IosAudioEngine() { microphoneWorker = PumpMicrophoneAsync(microphoneStop.Token); }