Browse Source

Fixed voice errors

tags/docs-0.9
RogueException 9 years ago
parent
commit
7b036446a2
2 changed files with 8 additions and 2 deletions
  1. +1
    -1
      src/Discord.Net/DiscordClientConfig.cs
  2. +7
    -1
      src/Discord.Net/Net/Voice/VoiceBuffer.cs

+ 1
- 1
src/Discord.Net/DiscordClientConfig.cs View File

@@ -21,7 +21,7 @@
private bool _ackMessages = false;

//Internal
internal override bool EnableVoice => base.EnableVoice && !EnableVoiceMultiserver;
internal override bool EnableVoice => (base.EnableVoice && !EnableVoiceMultiserver) || base.VoiceOnly;

public new DiscordClientConfig Clone()
{


+ 7
- 1
src/Discord.Net/Net/Voice/VoiceBuffer.cs View File

@@ -32,6 +32,9 @@ namespace Discord.Net.Voice

public void Push(byte[] buffer, int bytes, CancellationToken cancelToken)
{
if (cancelToken.IsCancellationRequested)
throw new OperationCanceledException("Client is disconnected.", cancelToken);

int wholeFrames = bytes / _frameSize;
int expectedBytes = wholeFrames * _frameSize;
int lastFrameSize = bytes - expectedBytes;
@@ -50,7 +53,10 @@ namespace Discord.Net.Voice
{
_notOverflowEvent.Wait(cancelToken);
}
catch (OperationCanceledException) { return; }
catch (OperationCanceledException ex)
{
throw new OperationCanceledException("Client is disconnected.", ex, cancelToken);
}
}

if (i == wholeFrames)


Loading…
Cancel
Save