Disable FEC (#2670)

* Remove incorrect usage of FEC

* Return instead of await
This commit is contained in:
Kuba_Z2
2023-04-18 18:12:05 +02:00
committed by GitHub
parent d5ba7d25aa
commit 2be9b00e72
3 changed files with 6 additions and 18 deletions

View File

@@ -5,7 +5,6 @@ namespace Discord.Audio
{
SetBitrate = 4002,
SetBandwidth = 4008,
SetInbandFEC = 4012,
SetPacketLossPercent = 4014,
SetSignal = 4024
}

View File

@@ -49,7 +49,6 @@ namespace Discord.Audio
CheckError(error);
CheckError(EncoderCtl(_ptr, OpusCtl.SetSignal, (int)opusSignal));
CheckError(EncoderCtl(_ptr, OpusCtl.SetPacketLossPercent, packetLoss)); //%
CheckError(EncoderCtl(_ptr, OpusCtl.SetInbandFEC, 1)); //True
CheckError(EncoderCtl(_ptr, OpusCtl.SetBitrate, bitrate));
}

View File

@@ -34,27 +34,17 @@ namespace Discord.Audio.Streams
}
/// <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)
throw new InvalidOperationException("Received payload without an RTP header.");
_hasHeader = false;
if (!_nextMissed)
{
count = _decoder.DecodeFrame(buffer, offset, count, _buffer, 0, false);
await _next.WriteAsync(_buffer, 0, count, cancelToken).ConfigureAwait(false);
}
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);
}
count = !_nextMissed || count > 0
? _decoder.DecodeFrame(buffer, offset, count, _buffer, 0, false)
: _decoder.DecodeFrame(null, 0, 0, _buffer, 0, false);
return _next.WriteAsync(_buffer, 0, count, cancelToken);
}
public override async Task FlushAsync(CancellationToken cancelToken)