Class RtpPacket
An RTP packet: the fixed header, header extensions of the one-byte form, and the payload; CSRCs are skipped when parsed.
Namespace: Uniform.Matrix.WebRtc.Rtp
Assembly: Uniform.Matrix.WebRtc.dll
public sealed record RtpPacket : IEquatable<RtpPacket>
Fields
|
Edit this page
View Source
Length of the fixed header.
Declaration
public const int HeaderLength = 12
Field Value
Properties
|
Edit this page
View Source
Header extensions by their ID, 1 to 14, as the SDP's extmap maps them, each 1 to 16 bytes; empty for none.
Declaration
public IReadOnlyList<(byte Id, byte[] Data)> Extensions { get; init; }
Property Value
|
Edit this page
View Source
The marker bit: for audio, the first packet after silence.
Declaration
public bool Marker { get; init; }
Property Value
|
Edit this page
View Source
Declaration
public required byte[] Payload { get; init; }
Property Value
|
Edit this page
View Source
The payload type, e.g. 111 for Opus as the SDP maps it.
Declaration
public required byte PayloadType { get; init; }
Property Value
|
Edit this page
View Source
The sequence number, one more per packet.
Declaration
public required ushort Sequence { get; init; }
Property Value
|
Edit this page
View Source
The synchronization source: identifies the stream.
Declaration
public required uint Ssrc { get; init; }
Property Value
|
Edit this page
View Source
The timestamp in the clock of the payload type, 48 kHz for Opus.
Declaration
public required uint Timestamp { get; init; }
Property Value
Methods
|
Edit this page
View Source
Return the packet on the wire.
Declaration
Returns
|
Edit this page
View Source
Return the data of extension id, or null.
Declaration
public byte[]? Extension(byte id)
Parameters
| Type |
Name |
Description |
| byte |
id |
|
Returns
|
Edit this page
View Source
Return whether an RTP or RTCP datagram is RTCP: its second byte, as a payload type with the marker, is 192 to 223, as RFC 5761 4 tells them apart when multiplexed.
Declaration
public static bool IsRtcp(ReadOnlySpan<byte> datagram)
Parameters
Returns
|
Edit this page
View Source
Return whether a datagram looks like RTP or RTCP: a first byte of 128 to 191, as RFC 7983 tells them from STUN and DTLS.
Declaration
public static bool IsRtpOrRtcp(ReadOnlySpan<byte> datagram)
Parameters
Returns
|
Edit this page
View Source
Parse a packet; null when it is not RTP version 2 or is too short.
Declaration
public static RtpPacket? Parse(ReadOnlySpan<byte> datagram)
Parameters
Returns
Implements