Skip to content

Commit

Permalink
#8125 Fix growing voice chat lag and double instance of voice chat co…
Browse files Browse the repository at this point in the history
…ntrol
  • Loading branch information
hasankhan committed Dec 16, 2013
1 parent e99640a commit 74cd281
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Shared/AssemblyInfo.Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion("3.3.2.0")]
[assembly: AssemblyVersion("3.3.3.0")]
1 change: 0 additions & 1 deletion Squiggle.UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("3.3.2.0")]
3 changes: 0 additions & 3 deletions Squiggle.UI/Windows/ChatWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,6 @@ public IVoiceChatHandler StartVoiceChat()

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

if (voiceChat != null)
chatTextBox.AddVoiceChatSentRequest(context, voiceChat, PrimaryBuddy.DisplayName);

return voiceChat;
}

Expand Down
32 changes: 22 additions & 10 deletions Squiggle.VoiceChat/EchoFilterWaveProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,32 @@ public int Read(byte[] buffer, int offset, int count)
{
lock (syncRoot)
{
while (remoteSound.BufferedBytes >= bytesPerFrame && localSound.BufferedBytes >= bytesPerFrame)
{
// read source of echo
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
// read local sound + echo
localSound.Read(localFrame, 0, bytesPerFrame);

filter.Filter(localFrame, remoteFrame, outputFrame);
filtered.AddSamples(outputFrame, 0, outputFrame.Length);
}
FilterEcho();
return filtered.Read(buffer, offset, count);
}
}

void FilterEcho()
{
while (remoteSound.BufferedBytes >= bytesPerFrame && localSound.BufferedBytes >= bytesPerFrame)
{
// read source of echo
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
// read local sound + echo
localSound.Read(localFrame, 0, bytesPerFrame);

filter.Filter(localFrame, remoteFrame, outputFrame);
filtered.AddSamples(outputFrame, 0, outputFrame.Length);
}

// read the remaining remote sound and play it
while (remoteSound.BufferedBytes > 0)
{
remoteSound.Read(remoteFrame, 0, bytesPerFrame);
filtered.AddSamples(remoteFrame, 0, remoteFrame.Length);
}
}

public void Dispose()
{
filter.Dispose();
Expand Down

0 comments on commit 74cd281

Please sign in to comment.