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()
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ public class PublishServerScriptTests
|
||||
Assert.Contains("SetPreferredInputOrientation(AVAudioStereoOrientation.None", router);
|
||||
Assert.Contains("AVAudioSession.PolarPatternStereo", router);
|
||||
Assert.Contains("SupportsStereoPolarPattern", router);
|
||||
Assert.Contains("route.TargetFrames = IosAudioRouter.Shared.UsesVoiceProcessing ? 3 : 6", engine);
|
||||
Assert.Contains("AdaptivePcmBuffer Ring = new(channels, 120, 65_536)", engine);
|
||||
Assert.Contains("SelectedDataSourceId = null; SelectedPolarPattern = AVAudioDataSourcePolarPattern.Unknown", router);
|
||||
Assert.Contains("ClearStereoPolarPattern(session)", router);
|
||||
Assert.Contains("CaptureChannels == 2\n ? port.DataSources?.FirstOrDefault", router);
|
||||
|
||||
Reference in New Issue
Block a user