Skip to content

Commit

Permalink
Send larger chunks of audio.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 20, 2021
1 parent a59d86b commit 11aa046
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
9 changes: 7 additions & 2 deletions Desktop.Win/Services/AudioCapturerWin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ private void Capturer_DataAvailable(object sender, WaveInEventArgs args)
{
try
{
if (args.Buffer.All(x => x == 0))
{
return;
}

if (args.BytesRecorded > 0)
{
lock (_tempBuffer)
Expand All @@ -51,8 +56,8 @@ private void Capturer_DataAvailable(object sender, WaveInEventArgs args)

_tempBuffer.AddRange(args.Buffer.Take(args.BytesRecorded));

if (_tempBuffer.Count > 5_000 ||
_sendTimer.Elapsed.TotalMilliseconds > 100)
if (_tempBuffer.Count > 50_000 ||
_sendTimer.Elapsed.TotalMilliseconds > 1000)
{
_sendTimer.Reset();
SendTempBuffer();
Expand Down
6 changes: 0 additions & 6 deletions Server/wwwroot/src/RemoteControl/Sound.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/wwwroot/src/RemoteControl/Sound.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions Server/wwwroot/src/RemoteControl/Sound.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export const Sound = new class {
Context: AudioContext;
SourceNodes: Array<MediaElementAudioSourceNode> = new Array<MediaElementAudioSourceNode>();

BackgroundAudio: HTMLAudioElement;
BackgroundNode: MediaElementAudioSourceNode;

Init() {
if (this.Context) {
Expand All @@ -20,9 +16,6 @@
else {
return;
}
this.BackgroundAudio = new Audio();
this.BackgroundNode = this.Context.createMediaElementSource(this.BackgroundAudio);
this.BackgroundNode.connect(this.Context.destination);
}

Play(buffer: Uint8Array) {
Expand Down
1 change: 0 additions & 1 deletion sipsorcery
Submodule sipsorcery deleted from 8e25c4

0 comments on commit 11aa046

Please sign in to comment.