Public Access
Make meeting lifecycle stateful
This commit is contained in:
@@ -100,7 +100,27 @@ public sealed class AzureSpeechSpeakerIdentityMatcherTests
|
||||
Assert.Null(match);
|
||||
}
|
||||
|
||||
private static AzureSpeechSpeakerIdentityMatcher CreateMatcher(ISpeakerIdentityDiarizationClient diarizationClient)
|
||||
[Fact]
|
||||
public async Task MatcherReturnsNullWhenDiarizationTimesOut()
|
||||
{
|
||||
var matcher = CreateMatcher(
|
||||
new HangingSpeakerIdentityDiarizationClient(),
|
||||
TimeSpan.FromMilliseconds(20));
|
||||
var snippet = CreateWavSnippet();
|
||||
|
||||
var match = await matcher.MatchAsync(
|
||||
new SpeakerIdentityMatchRequest(
|
||||
"Guest03",
|
||||
snippet,
|
||||
[new SpeakerIdentityMatchCandidate(42, "Chris", 5, [snippet])]),
|
||||
CancellationToken.None);
|
||||
|
||||
Assert.Null(match);
|
||||
}
|
||||
|
||||
private static AzureSpeechSpeakerIdentityMatcher CreateMatcher(
|
||||
ISpeakerIdentityDiarizationClient diarizationClient,
|
||||
TimeSpan? matchTimeout = null)
|
||||
{
|
||||
return new AzureSpeechSpeakerIdentityMatcher(
|
||||
diarizationClient,
|
||||
@@ -108,7 +128,8 @@ public sealed class AzureSpeechSpeakerIdentityMatcherTests
|
||||
{
|
||||
SpeakerIdentification = new SpeakerIdentificationOptions
|
||||
{
|
||||
SilenceBetweenSnippetsSeconds = 1
|
||||
SilenceBetweenSnippetsSeconds = 1,
|
||||
MatchTimeout = matchTimeout ?? TimeSpan.FromMinutes(1)
|
||||
}
|
||||
}),
|
||||
NullLogger<AzureSpeechSpeakerIdentityMatcher>.Instance);
|
||||
@@ -145,4 +166,15 @@ public sealed class AzureSpeechSpeakerIdentityMatcherTests
|
||||
return Task.FromResult(segments);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class HangingSpeakerIdentityDiarizationClient : ISpeakerIdentityDiarizationClient
|
||||
{
|
||||
public async Task<IReadOnlyList<TranscriptionSegment>> DiarizeAsync(
|
||||
string wavPath,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
await Task.Delay(Timeout.InfiniteTimeSpan, cancellationToken);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user