More audio cleanup, finished receive streams
This commit is contained in:
@@ -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();
|
||||
|
||||
16
src/Discord.Net.Core/Audio/RTPFrame.cs
Normal file
16
src/Discord.Net.Core/Audio/RTPFrame.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user