Class VoiceMedia
The voice of a call: the microphone's frames encoded with Opus and sent over a peer connection, and the frames received put in order by a jitter buffer, decoded, and played as the speaker needs them.
Implements
Inherited Members
Namespace: Uniform.Matrix.Calls
Assembly: Uniform.Matrix.Calls.dll
Syntax
public sealed class VoiceMedia : IAsyncDisposable
Remarks
The speaker's clock paces playing: a timer tops up its buffer to SpeakerTarget, one frame at a time from the jitter buffer, concealing lost ones. So the sender's and the speaker's clocks may drift apart without the delay growing.
Constructors
| Edit this page View SourceVoiceMedia(IMediaConnection, IAudioDevices)
Open the devices for a connection; nothing records or plays until Start().
Declaration
public VoiceMedia(IMediaConnection connection, IAudioDevices devices)
Parameters
| Type | Name | Description |
|---|---|---|
| IMediaConnection | connection | |
| IAudioDevices | devices |
Fields
| Edit this page View SourceSpeakerTarget
How much audio the speaker is kept queued.
Declaration
public static readonly TimeSpan SpeakerTarget
Field Value
| Type | Description |
|---|---|
| TimeSpan |
Properties
| Edit this page View SourceLost
Frames received that were lost, and concealed.
Declaration
public long Lost { get; }
Property Value
| Type | Description |
|---|---|
| long |
Muted
Whether the microphone is muted; muted frames are not sent, and the next one sent is marked.
Declaration
public bool Muted { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Received
Frames received.
Declaration
public long Received { get; }
Property Value
| Type | Description |
|---|---|
| long |
Sent
Frames sent.
Declaration
public long Sent { get; }
Property Value
| Type | Description |
|---|---|
| long |
Underruns
Frames concealed while waiting for a late packet.
Declaration
public long Underruns { get; }
Property Value
| Type | Description |
|---|---|
| long |
Methods
| Edit this page View SourceDisposeAsync()
Stop, and close the devices.
Declaration
public ValueTask DisposeAsync()
Returns
| Type | Description |
|---|---|
| ValueTask |
Start()
Start recording and playing.
Declaration
public void Start()
Events
| Edit this page View SourceDeviceFailed
Raised when a device fails while the call plays or records, e.g. a speaker that stops.
Declaration
public event Action<Exception>? DeviceFailed
Event Type
| Type | Description |
|---|---|
| Action<Exception> |