Disable FEC (#2670)
* Remove incorrect usage of FEC * Return instead of await
This commit is contained in:
@@ -5,7 +5,6 @@ namespace Discord.Audio
|
|||||||
{
|
{
|
||||||
SetBitrate = 4002,
|
SetBitrate = 4002,
|
||||||
SetBandwidth = 4008,
|
SetBandwidth = 4008,
|
||||||
SetInbandFEC = 4012,
|
|
||||||
SetPacketLossPercent = 4014,
|
SetPacketLossPercent = 4014,
|
||||||
SetSignal = 4024
|
SetSignal = 4024
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace Discord.Audio
|
|||||||
CheckError(error);
|
CheckError(error);
|
||||||
CheckError(EncoderCtl(_ptr, OpusCtl.SetSignal, (int)opusSignal));
|
CheckError(EncoderCtl(_ptr, OpusCtl.SetSignal, (int)opusSignal));
|
||||||
CheckError(EncoderCtl(_ptr, OpusCtl.SetPacketLossPercent, packetLoss)); //%
|
CheckError(EncoderCtl(_ptr, OpusCtl.SetPacketLossPercent, packetLoss)); //%
|
||||||
CheckError(EncoderCtl(_ptr, OpusCtl.SetInbandFEC, 1)); //True
|
|
||||||
CheckError(EncoderCtl(_ptr, OpusCtl.SetBitrate, bitrate));
|
CheckError(EncoderCtl(_ptr, OpusCtl.SetBitrate, bitrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,27 +34,17 @@ namespace Discord.Audio.Streams
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="InvalidOperationException">Received payload without an RTP header.</exception>
|
/// <exception cref="InvalidOperationException">Received payload without an RTP header.</exception>
|
||||||
public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)
|
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
if (!_hasHeader)
|
if (!_hasHeader)
|
||||||
throw new InvalidOperationException("Received payload without an RTP header.");
|
throw new InvalidOperationException("Received payload without an RTP header.");
|
||||||
_hasHeader = false;
|
_hasHeader = false;
|
||||||
|
|
||||||
if (!_nextMissed)
|
count = !_nextMissed || count > 0
|
||||||
{
|
? _decoder.DecodeFrame(buffer, offset, count, _buffer, 0, false)
|
||||||
count = _decoder.DecodeFrame(buffer, offset, count, _buffer, 0, false);
|
: _decoder.DecodeFrame(null, 0, 0, _buffer, 0, false);
|
||||||
await _next.WriteAsync(_buffer, 0, count, cancelToken).ConfigureAwait(false);
|
|
||||||
}
|
return _next.WriteAsync(_buffer, 0, count, cancelToken);
|
||||||
else if (count > 0)
|
|
||||||
{
|
|
||||||
count = _decoder.DecodeFrame(buffer, offset, count, _buffer, 0, true);
|
|
||||||
await _next.WriteAsync(_buffer, 0, count, cancelToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
count = _decoder.DecodeFrame(null, 0, 0, _buffer, 0, true);
|
|
||||||
await _next.WriteAsync(_buffer, 0, count, cancelToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task FlushAsync(CancellationToken cancelToken)
|
public override async Task FlushAsync(CancellationToken cancelToken)
|
||||||
|
|||||||
Reference in New Issue
Block a user