Fixed voice errors
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
private bool _ackMessages = false;
|
private bool _ackMessages = false;
|
||||||
|
|
||||||
//Internal
|
//Internal
|
||||||
internal override bool EnableVoice => base.EnableVoice && !EnableVoiceMultiserver;
|
internal override bool EnableVoice => (base.EnableVoice && !EnableVoiceMultiserver) || base.VoiceOnly;
|
||||||
|
|
||||||
public new DiscordClientConfig Clone()
|
public new DiscordClientConfig Clone()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ namespace Discord.Net.Voice
|
|||||||
|
|
||||||
public void Push(byte[] buffer, int bytes, CancellationToken cancelToken)
|
public void Push(byte[] buffer, int bytes, CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
|
if (cancelToken.IsCancellationRequested)
|
||||||
|
throw new OperationCanceledException("Client is disconnected.", cancelToken);
|
||||||
|
|
||||||
int wholeFrames = bytes / _frameSize;
|
int wholeFrames = bytes / _frameSize;
|
||||||
int expectedBytes = wholeFrames * _frameSize;
|
int expectedBytes = wholeFrames * _frameSize;
|
||||||
int lastFrameSize = bytes - expectedBytes;
|
int lastFrameSize = bytes - expectedBytes;
|
||||||
@@ -50,7 +53,10 @@ namespace Discord.Net.Voice
|
|||||||
{
|
{
|
||||||
_notOverflowEvent.Wait(cancelToken);
|
_notOverflowEvent.Wait(cancelToken);
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { return; }
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
throw new OperationCanceledException("Client is disconnected.", ex, cancelToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == wholeFrames)
|
if (i == wholeFrames)
|
||||||
|
|||||||
Reference in New Issue
Block a user