-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- tiny performance improvement in the encoder - added early chain abort check - readded stall checker
- Loading branch information
Showing
35 changed files
with
218 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// TS3AudioBot - An advanced Musicbot for Teamspeak 3 | ||
// Copyright (C) 2017 TS3AudioBot contributors | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the Open Software License v. 3.0 | ||
// | ||
// You should have received a copy of the Open Software License along with this | ||
// program. If not, see <https://opensource.org/licenses/OSL-3.0>. | ||
|
||
namespace TS3AudioBot.Audio | ||
{ | ||
using System; | ||
using TS3Client.Audio; | ||
|
||
public class StallCheckPipe : IAudioPipe | ||
{ | ||
private const uint StallCountInterval = 10; | ||
private const uint StallNoErrorCountMax = 5; | ||
|
||
public bool Active => OutStream?.Active ?? false; | ||
public IAudioPassiveConsumer OutStream { get; set; } | ||
|
||
private bool isStall; | ||
private uint stallCount; | ||
private uint stallNoErrorCount; | ||
|
||
public StallCheckPipe() | ||
{ | ||
isStall = false; | ||
stallCount = 0; | ||
} | ||
|
||
public void Write(Span<byte> data, Meta meta) | ||
{ | ||
if (OutStream == null) return; | ||
|
||
if (isStall) | ||
{ | ||
// TODO maybe do time-cooldown instead of call-count-cooldown | ||
if (++stallCount % StallCountInterval == 0) | ||
{ | ||
stallNoErrorCount++; | ||
if (stallNoErrorCount > StallNoErrorCountMax) | ||
{ | ||
stallCount = 0; | ||
isStall = false; | ||
} | ||
} | ||
else | ||
{ | ||
return; | ||
} | ||
} | ||
|
||
OutStream?.Write(data, meta); | ||
} | ||
|
||
public void SetStall() | ||
{ | ||
stallNoErrorCount = 0; | ||
isStall = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// TS3Client - A free TeamSpeak3 client implementation | ||
// Copyright (C) 2017 TS3Client contributors | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the Open Software License v. 3.0 | ||
// | ||
// You should have received a copy of the Open Software License along with this | ||
// program. If not, see <https://opensource.org/licenses/OSL-3.0>. | ||
|
||
namespace TS3Client.Audio | ||
{ | ||
using System; | ||
|
||
public class ActiveCheckPipe : IAudioPipe | ||
{ | ||
public bool Active => OutStream?.Active ?? false; | ||
public IAudioPassiveConsumer OutStream { get; set; } | ||
|
||
public void Write(Span<byte> data, Meta meta) | ||
{ | ||
if (OutStream == null || !Active) | ||
return; | ||
|
||
OutStream?.Write(data, meta); | ||
} | ||
} | ||
} |
Oops, something went wrong.