Table of Contents

Class SodiumEncryptStream

Namespace
Discord.Audio.Streams
Assembly
Discord.Net.WebSocket.dll

Encrypts an RTP frame using libsodium.

public class SodiumEncryptStream : AudioOutStream, IAsyncDisposable, IDisposable
Inheritance
SodiumEncryptStream
Implements
Inherited Members

Constructors

SodiumEncryptStream(AudioStream, IAudioClient)

public SodiumEncryptStream(AudioStream next, IAudioClient client)

Parameters

next AudioStream
client IAudioClient

Methods

ClearAsync(CancellationToken)

public override Task ClearAsync(CancellationToken cancelToken)

Parameters

cancelToken CancellationToken

Returns

Task

Dispose(bool)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

FlushAsync(CancellationToken)

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

public override Task FlushAsync(CancellationToken cancelToken)

Parameters

cancelToken CancellationToken

Returns

Task

A task that represents the asynchronous flush operation.

Exceptions

ObjectDisposedException

The stream has been disposed.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.

WriteAsync(byte[], int, int, CancellationToken)

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)

Parameters

buffer byte[]
offset int
count int
cancelToken CancellationToken

Returns

Task

Exceptions

InvalidOperationException

Received payload without an RTP header.

OperationCanceledException

The token has had cancellation requested.

ObjectDisposedException

The associated CancellationTokenSource has been disposed.

WriteHeader(ushort, uint, bool)

public override void WriteHeader(ushort seq, uint timestamp, bool missed)

Parameters

seq ushort
timestamp uint
missed bool

Exceptions

InvalidOperationException

Header received with no payload.