Improve iOS voice stability and user audio controls
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user