Use Discord heartbeat interval in audio. (#2765)

Reduce heartbeat interval to ensure Discord receives it within range.
Refactor some AudioClient code.

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
José Santos Garrido
2023-11-18 21:52:48 +01:00
committed by GitHub
parent 8d5022acb8
commit 9cedfbcdd9
3 changed files with 62 additions and 38 deletions

View File

@@ -238,6 +238,15 @@ namespace Discord
/// </summary>
public const int MaxApplicationTagCount = 5;
/// <summary>
/// Returns the factor to reduce the heartbeat interval.
/// </summary>
/// <remarks>
/// If a heartbeat takes longer than the interval estimated by Discord, the connection will be closed.
/// This factor is used to reduce the interval and ensure that Discord will get the heartbeat within the estimated interval.
/// </remarks>
internal const double HeartbeatIntervalFactor = 0.9;
/// <summary>
/// Returns the maximum length of a voice channel status.
/// </summary>