Class AudioInStream
表示一个通用的输入音频流。
public abstract class AudioInStream : AudioStream, IAsyncDisposable, IDisposable
- Inheritance
-
AudioInStream
- Implements
- Derived
- Inherited Members
Properties
AvailableFrames
获取当前可用的帧数。
public abstract 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
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
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 cancellationToken)
Parameters
cancellationToken
CancellationTokenThe token to monitor for cancellation requests. The default value is None.
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.
ReadFrameAsync(CancellationToken)
读取一个 RTP 帧。
public abstract Task<RtpFrame> ReadFrameAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken用于取消任务的取消令牌。
Returns
TryReadFrame(CancellationToken, out RtpFrame)
尝试读取一个 RTP 帧。
public abstract bool TryReadFrame(CancellationToken cancellationToken, out RtpFrame frame)
Parameters
cancellationToken
CancellationToken用于取消任务的取消令牌。
frame
RtpFrame如果成功读取到 RTP 帧,则为读取到的 RTP 帧;否则为 default。
Returns
- bool
是否成功读取到 RTP 帧。