Improve iOS voice stability and user audio controls
Build and test / test (macos-latest) (push) Canceled after 0s
Build and test / test (ubuntu-24.04) (push) Canceled after 0s
Build and test / test (windows-latest) (push) Canceled after 0s
Build and test / apple-client (push) Canceled after 0s

This commit is contained in:
2026-09-22 22:07:00 +02:00
parent 7b0c003ad4
commit ea76d5157a
15 changed files with 460 additions and 68 deletions
+37
View File
@@ -102,6 +102,28 @@ public class AudioEngineTests
Assert.True(fullReads > 5_000);
}
[Theory]
[InlineData(-1000)]
[InlineData(1000)]
public void AdaptivePcmBufferKeepsBurstingIosCaptureBoundedOverLongCalls(int partsPerMillion)
{
var buffer = new AdaptivePcmBuffer(1, 120, 65_536);
short[] callback = new short[4_800], encoded = new short[960];
long produced = 0;
int lateStarvation = 0;
for (long consumerFrame = 0; consumerFrame < 48_000L * 600; consumerFrame += 960)
{
while (produced / (1 + partsPerMillion / 1_000_000.0) <= consumerFrame)
{
Assert.True(buffer.TryWrite(callback));
produced += callback.Length;
}
if (buffer.Read(encoded) == 0 && consumerFrame >= 48_000) lateStarvation++;
Assert.InRange(buffer.CountFrames, 0, 20_000);
}
Assert.Equal(0, lateStarvation);
}
[Fact]
public void OneCaptureMissDoesNotRestartTalkspurtButSustainedStarvationDoes()
{
@@ -260,6 +282,21 @@ public class AudioEngineTests
Assert.Equal(0, GC.GetAllocatedBytesForCurrentThread() - before);
}
[Fact]
public void RemotePlaybackSettingsAreIndependentForEachUserStream()
{
StreamInfo microphone = Stream();
StreamInfo screen = Stream(); screen.StreamId = 2; screen.Ssrc = 43; screen.Kind = StreamKind.StreamScreenAudio; screen.Label = "Screen audio";
using var receive = new AudioEngine((_, _, _, _) => true, false);
receive.SetRemoteStreams([new() { Id = 7, ChannelId = 1, Streams = { microphone, screen } }], 1, 1);
receive.SetRemotePlayback(7, microphone.StreamId, 0.5f, true, true);
receive.SetRemotePlayback(7, screen.StreamId, 1.75f, false, false);
Assert.Equal((0.5f, true, true), receive.GetRemotePlayback(7, microphone.StreamId));
Assert.Equal((1.75f, false, false), receive.GetRemotePlayback(7, screen.StreamId));
}
[Fact]
public void JitterBacklogIsBoundedAndPlcEventuallyBecomesSilence()
{