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

@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Discord.Audio
{
@@ -10,6 +11,16 @@ namespace Discord.Audio
public override bool CanSeek => false;
public override bool CanWrite => true;
public abstract Task<RTPFrame?> ReadFrameAsync(CancellationToken cancelToken);
public RTPFrame? ReadFrame()
{
return ReadFrameAsync(CancellationToken.None).GetAwaiter().GetResult();
}
public override int Read(byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();
}
public override void Write(byte[] buffer, int offset, int count)
{
WriteAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();

View File

@@ -0,0 +1,16 @@
namespace Discord.Audio
{
public struct RTPFrame
{
public readonly ushort Sequence;
public readonly uint Timestamp;
public readonly byte[] Payload;
public RTPFrame(ushort sequence, uint timestamp, byte[] payload)
{
Sequence = sequence;
Timestamp = timestamp;
Payload = payload;
}
}
}