webrtc_jsep_caps (webrtc v0.1.0)

View Source

Media capabilities and their negotiation for JSEP (RFC 9429 §5.2.1, §5.3.1, RFC 3264 §6.1).

A codec is the map used by webrtc_sdp_media:codecs/1. Matching follows RFC 3264: same encoding name (case-insensitive), clock rate and channel count, plus the format parameters that identify a distinct codec (H.264 profile and packetization mode, VP9 profile). Retransmission codecs (RFC 4588) follow the codec named by apt.

Summary

Types

encrypt: sent with RFC 6904 header extension encryption, signaled as urn:ietf:params:rtp-hdrext:encrypt <uri>.

Functions

Codecs for an answer: the offered codecs we support, in the offer's order and with the offer's payload types (RFC 3264 §6.1, RFC 9429 §5.3.1). Feedback is the intersection; our format parameters describe what we receive, except H.264 where the offered profile-level-id is kept.

Offered header extensions we support, keeping the offered ids (RFC 8285 §5). An extension offered both in clear and encrypted (RFC 6904 §4.1) is answered encrypted when we can, and never in both forms.

The extensions of Mine in the form (clear or encrypted) the other description Theirs also has (RFC 8285 §6, RFC 6904 §4.1).

Codecs we can transport. RFC 7874 requires Opus and G.711 (PCMU, PCMA) for audio; RFC 7742 requires VP8 and H.264 constrained baseline for video. The library forwards payloads; encoding and decoding are the application's concern.

Ids of the encrypted extensions of a list.

#{Uri => Id} for a list of extensions, by their own URI whether encrypted or not.

A format parameter of a codec.

True for a ccm tmmbr line, with or without smaxpr (RFC 5104 §7.1).

Codecs of a remote description that we can send, with the remote payload types (the ones the remote expects to receive).

An extension or a=extmap value with the encrypted form told apart: uri is the extension's own URI and encrypt says whether it is sent encrypted (RFC 6904 §4).

The attributes of a ccm pause feedback line (RFC 7728 §9), or undefined for other feedback.

Same codec in the RFC 3264 sense (see the module doc).

True when no extension appears both in clear and encrypted (an answer must not negotiate both, RFC 6904 §4.1).

The a=extmap value of an extension.

Types

codec/0

-type codec() :: webrtc_sdp_media:codec().

encrypt: sent with RFC 6904 header extension encryption, signaled as urn:ietf:params:rtp-hdrext:encrypt <uri>.

extension/0

-type extension() :: #{id := pos_integer(), uri := binary(), encrypt => boolean()}.

kind/0

-type kind() :: audio | video.

Functions

answer_codecs(Offered0, Local)

-spec answer_codecs([codec()], [codec()]) -> [codec()].

Codecs for an answer: the offered codecs we support, in the offer's order and with the offer's payload types (RFC 3264 §6.1, RFC 9429 §5.3.1). Feedback is the intersection; our format parameters describe what we receive, except H.264 where the offered profile-level-id is kept.

answer_extensions(Offered0, Local0)

-spec answer_extensions([webrtc_sdp_rtp:extmap()], [extension()]) -> [extension()].

Offered header extensions we support, keeping the offered ids (RFC 8285 §5). An extension offered both in clear and encrypted (RFC 6904 §4.1) is answered encrypted when we can, and never in both forms.

common_extensions(Mine, Theirs)

-spec common_extensions([webrtc_sdp_rtp:extmap()], [webrtc_sdp_rtp:extmap()]) -> [extension()].

The extensions of Mine in the form (clear or encrypted) the other description Theirs also has (RFC 8285 §6, RFC 6904 §4.1).

default_codecs(_)

-spec default_codecs(kind()) -> [codec()].

Codecs we can transport. RFC 7874 requires Opus and G.711 (PCMU, PCMA) for audio; RFC 7742 requires VP8 and H.264 constrained baseline for video. The library forwards payloads; encoding and decoding are the application's concern.

default_extensions(_)

-spec default_extensions(kind()) -> [extension()].

encrypted_ids(Exts)

-spec encrypted_ids([extension() | webrtc_sdp_rtp:extmap()]) -> [pos_integer()].

Ids of the encrypted extensions of a list.

extension_map(Exts)

-spec extension_map([extension() | webrtc_sdp_rtp:extmap()]) -> #{binary() => pos_integer()}.

#{Uri => Id} for a list of extensions, by their own URI whether encrypted or not.

fmtp(Key, _)

-spec fmtp(binary(), codec()) -> binary() | undefined.

A format parameter of a codec.

is_tmmbr(_)

-spec is_tmmbr(map()) -> boolean().

True for a ccm tmmbr line, with or without smaxpr (RFC 5104 §7.1).

match_remote(Remote, Local)

-spec match_remote([codec()], [codec()]) -> [codec()].

Codecs of a remote description that we can send, with the remote payload types (the ones the remote expects to receive).

normalize(E)

-spec normalize(extension() | webrtc_sdp_rtp:extmap()) -> extension().

An extension or a=extmap value with the encrypted form told apart: uri is the extension's own URI and encrypt says whether it is sent encrypted (RFC 6904 §4).

pause_params(_)

-spec pause_params(map()) -> undefined | [binary()].

The attributes of a ccm pause feedback line (RFC 7728 §9), or undefined for other feedback.

same_codec(A, B)

-spec same_codec(codec(), codec()) -> boolean().

Same codec in the RFC 3264 sense (see the module doc).

single_forms(Exts)

-spec single_forms([webrtc_sdp_rtp:extmap()]) -> boolean().

True when no extension appears both in clear and encrypted (an answer must not negotiate both, RFC 6904 §4.1).

to_extmap(E)

-spec to_extmap(extension()) -> webrtc_sdp_rtp:extmap().

The a=extmap value of an extension.