Skip to content

Commit 74cd281

Browse files
committed
#8125 Fix growing voice chat lag and double instance of voice chat control
1 parent e99640a commit 74cd281

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

Shared/AssemblyInfo.Version.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
44

5-
[assembly: AssemblyVersion("3.3.2.0")]
5+
[assembly: AssemblyVersion("3.3.3.0")]

Squiggle.UI/Properties/AssemblyInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@
4242
// You can specify all the values or you can default the Build and Revision Numbers
4343
// by using the '*' as shown below:
4444
// [assembly: AssemblyVersion("1.0.*")]
45-
[assembly: AssemblyFileVersion("3.3.2.0")]

Squiggle.UI/Windows/ChatWindow.xaml.cs

-3
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,6 @@ public IVoiceChatHandler StartVoiceChat()
623623

624624
var voiceChat = (IVoiceChatHandler)StartActivity(SquiggleActivities.VoiceChat, null);
625625

626-
if (voiceChat != null)
627-
chatTextBox.AddVoiceChatSentRequest(context, voiceChat, PrimaryBuddy.DisplayName);
628-
629626
return voiceChat;
630627
}
631628

Squiggle.VoiceChat/EchoFilterWaveProvider.cs

+22-10
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,32 @@ public int Read(byte[] buffer, int offset, int count)
5555
{
5656
lock (syncRoot)
5757
{
58-
while (remoteSound.BufferedBytes >= bytesPerFrame && localSound.BufferedBytes >= bytesPerFrame)
59-
{
60-
// read source of echo
61-
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
62-
// read local sound + echo
63-
localSound.Read(localFrame, 0, bytesPerFrame);
64-
65-
filter.Filter(localFrame, remoteFrame, outputFrame);
66-
filtered.AddSamples(outputFrame, 0, outputFrame.Length);
67-
}
58+
FilterEcho();
6859
return filtered.Read(buffer, offset, count);
6960
}
7061
}
7162

63+
void FilterEcho()
64+
{
65+
while (remoteSound.BufferedBytes >= bytesPerFrame && localSound.BufferedBytes >= bytesPerFrame)
66+
{
67+
// read source of echo
68+
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
69+
// read local sound + echo
70+
localSound.Read(localFrame, 0, bytesPerFrame);
71+
72+
filter.Filter(localFrame, remoteFrame, outputFrame);
73+
filtered.AddSamples(outputFrame, 0, outputFrame.Length);
74+
}
75+
76+
// read the remaining remote sound and play it
77+
while (remoteSound.BufferedBytes > 0)
78+
{
79+
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
80+
filtered.AddSamples(remoteFrame, 0, remoteFrame.Length);
81+
}
82+
}
83+
7284
public void Dispose()
7385
{
7486
filter.Dispose();

0 commit comments

Comments
 (0)