webrtc_dscp (webrtc v0.1.0)

View Source

DSCP values for WebRTC flows (RFC 8837 §5, Table 1), as RFC 8835 §4.2 asks implementations to mark their packets.

The flow type and the application priority pick the value. Where a cell has two values, the first (lower drop precedence) is for the more important packets of the flow: those of a key frame.

| Flow type | very_low | low | medium | high | |---|---|---|---|---| | audio | LE 1 | DF 0 | EF 46 | EF 46 | | interactive video | LE 1 | DF 0 | AF42 36, AF43 38 | AF41 34, AF42 36 | | non-interactive video | LE 1 | DF 0 | AF32 28, AF33 30 | AF31 26, AF32 28 | | data | LE 1 | DF 0 | AF11 10 | AF21 18 |

The default priority, low, is DF: nothing is marked unless the application sets a priority. Browsers MUST NOT use AF3x; this library is not a browser and uses it for video the application says is not interactive, as RFC 8837 §5 allows.

Summary

Functions

The priority class of a data channel's DCEP priority (RFC 8831 §6.4: 128, 256, 512 and 1024, values between round down).

The DSCP of a packet: flow kind, application priority, whether the video is interactive, whether the packet is among the important ones of its flow.

Validate an application priority.

The IP TOS or traffic class byte: DSCP in the upper six bits, ECN in the lower two.

Types

kind/0

-type kind() :: audio | video | data.

priority/0

-type priority() :: very_low | low | medium | high.

Functions

class(P)

-spec class(0..65535) -> priority().

The priority class of a data channel's DCEP priority (RFC 8831 §6.4: 128, 256, 512 and 1024, values between round down).

dscp(_, P, _, Important)

-spec dscp(kind(), priority(), boolean(), boolean()) -> 0..63.

The DSCP of a packet: flow kind, application priority, whether the video is interactive, whether the packet is among the important ones of its flow.

priority(P)

-spec priority(term()) -> {ok, priority()} | error.

Validate an application priority.

tos(Dscp, Ecn)

-spec tos(0..63, 0..3) -> 0..255.

The IP TOS or traffic class byte: DSCP in the upper six bits, ECN in the lower two.