fix: recover from microphone disconnects
PR and Push Build/Test / build-and-test (push) Successful in 12m29s

This commit is contained in:
2026-08-03 15:57:30 +02:00
parent 75250f6041
commit b9547ae4c4
16 changed files with 574 additions and 40 deletions
@@ -102,6 +102,23 @@ public sealed class AudioMixingTests
Assert.Equal(2_000, BitConverter.ToInt16(chunks[0].Pcm));
}
[Fact]
public async Task CompositeAudioSourceKeepsSystemAudioWhileMicrophoneIsRecovering()
{
var microphone = new WaitingAudioSource();
var system = new FixedAudioSource(Pcm16(10_000));
var source = CreateSource(microphone, system);
using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(5));
await using var chunks = source
.CaptureAsync(new MeetingAssistantOptions(), cancellation.Token)
.GetAsyncEnumerator(cancellation.Token);
Assert.True(await chunks.MoveNextAsync());
Assert.Equal(10_000, BitConverter.ToInt16(chunks.Current.Pcm));
await cancellation.CancelAsync();
}
[Fact]
public void AdaptiveEchoCancellerReducesEchoFromMicrophoneSignal()
{
@@ -221,6 +238,16 @@ public sealed class AudioMixingTests
}
}
private sealed class WaitingAudioSource : IMeetingAudioSource
{
public async IAsyncEnumerable<AudioChunk> CaptureAsync(
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken)
{
await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
yield break;
}
}
private sealed class OptionsCapturingAudioSource : IMeetingAudioSource
{
private readonly AudioChunk chunk;