Class InputStream
Reads the payload from an RTP frame
public class InputStream : AudioInStream, IAsyncDisposable, IDisposable
- Inheritance
-
InputStream
- Implements
- Inherited Members
Constructors
InputStream()
public InputStream()
Properties
AvailableFrames
public override int AvailableFrames { get; }
Property Value
CanRead
When overridden in a derived class, gets a value indicating whether the current stream supports reading.
public override bool CanRead { get; }
Property Value
CanSeek
When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
public override bool CanSeek { get; }
Property Value
CanWrite
When overridden in a derived class, gets a value indicating whether the current stream supports writing.
public override bool CanWrite { get; }
Property Value
Methods
Dispose(bool)
Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
protected override void Dispose(bool isDisposing)
Parameters
isDisposing
bool
ReadAsync(byte[], int, int, CancellationToken)
Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)
Parameters
buffer
byte[]The buffer to write the data into.
offset
intThe byte offset in
buffer
at which to begin writing data from the stream.count
intThe maximum number of bytes to read.
cancelToken
CancellationToken
Returns
- Task<int>
A task that represents the asynchronous read operation. The value of the
TResult
parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.
Exceptions
- ArgumentNullException
buffer
is null.- ArgumentOutOfRangeException
offset
orcount
is negative.- ArgumentException
The sum of
offset
andcount
is larger than the buffer length.- NotSupportedException
The stream does not support reading.
- ObjectDisposedException
The stream has been disposed.
- InvalidOperationException
The stream is currently in use by a previous read operation.
ReadFrameAsync(CancellationToken)
public override Task<RTPFrame> ReadFrameAsync(CancellationToken cancelToken)
Parameters
cancelToken
CancellationToken
Returns
TryReadFrame(CancellationToken, out RTPFrame)
public override bool TryReadFrame(CancellationToken cancelToken, out RTPFrame frame)
Parameters
cancelToken
CancellationTokenframe
RTPFrame
Returns
WriteAsync(byte[], int, int, CancellationToken)
Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)
Parameters
buffer
byte[]The buffer to write data from.
offset
intThe zero-based byte offset in
buffer
from which to begin copying bytes to the stream.count
intThe maximum number of bytes to write.
cancelToken
CancellationToken
Returns
- Task
A task that represents the asynchronous write operation.
Exceptions
- ArgumentNullException
buffer
is null.- ArgumentOutOfRangeException
offset
orcount
is negative.- ArgumentException
The sum of
offset
andcount
is larger than the buffer length.- NotSupportedException
The stream does not support writing.
- ObjectDisposedException
The stream has been disposed.
- InvalidOperationException
The stream is currently in use by a previous write operation.
WriteHeader(ushort, uint, bool)
public override void WriteHeader(ushort seq, uint timestamp, bool missed)
Parameters
Exceptions
- InvalidOperationException
This stream does not accept headers.