More audio cleanup, finished receive streams

This commit is contained in:
RogueException
2017-02-26 13:43:11 -04:00
parent 8e0c65498b
commit 4c2221dacb
11 changed files with 174 additions and 84 deletions

View File

@@ -14,7 +14,7 @@ namespace Discord.Audio.Streams
protected readonly byte[] _buffer;
internal RTPWriteStream(AudioOutStream next, int samplesPerFrame, uint ssrc, int bufferSize = 4000)
public RTPWriteStream(AudioOutStream next, int samplesPerFrame, uint ssrc, int bufferSize = 4000)
{
_next = next;
_samplesPerFrame = samplesPerFrame;
@@ -29,13 +29,10 @@ namespace Discord.Audio.Streams
_header[11] = (byte)(_ssrc >> 0);
}
public override void Write(byte[] buffer, int offset, int count)
{
WriteAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();
}
public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
unchecked
{
if (_header[3]++ == byte.MaxValue)