Table of Contents

Class AudioInStream

Namespace
Kook.Audio
Assembly
Kook.Net.Core.dll

表示一个通用的输入音频流。

public abstract class AudioInStream : AudioStream, IAsyncDisposable, IDisposable
Inheritance
AudioInStream
Implements
Derived
Inherited Members

Properties

AvailableFrames

获取当前可用的帧数。

public abstract int AvailableFrames { get; }

Property Value

int

CanRead

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

public override bool CanRead { get; }

Property Value

bool

true if the stream supports reading; otherwise, false.

CanWrite

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

public override bool CanWrite { get; }

Property Value

bool

true if the stream supports writing; otherwise, false.

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 CancellationToken

The 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.

ReadFrameAsync(CancellationToken)

读取一个 RTP 帧。

public abstract Task<RtpFrame> ReadFrameAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

用于取消任务的取消令牌。

Returns

Task<RtpFrame>

一个表示异步读取的任务。任务的结果为读取到的 RTP 帧。

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 帧。