You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
879 B

using System.Threading;
using System.Threading.Tasks;
namespace Discord.Audio.Streams
{
///<summary> Wraps an IAudioClient, sending voice data on write. </summary>
public class OutputStream : AudioOutStream
{
private readonly DiscordVoiceAPIClient _client;
public OutputStream(IAudioClient client)
: this((client as AudioClient).ApiClient) { }
internal OutputStream(DiscordVoiceAPIClient client)
{
_client = client;
}
public override void WriteHeader(ushort seq, uint timestamp, bool missed) { } //Ignore
public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)
{
cancelToken.ThrowIfCancellationRequested();
await _client.SendAsync(buffer, offset, count).ConfigureAwait(false);
}
}
}