webrtc_sdp_rtp (webrtc v0.1.0)

View Source

RTP related SDP attribute values: rtpmap and fmtp (RFC 8866 §6), rtcp-fb (RFC 4585 §4.2), extmap (RFC 8285 §8), msid (RFC 8830), legacy msid-semantic, ssrc and ssrc-group (RFC 5576). rid and simulcast values are handled by webrtc_sdp_rid.

parse/2 takes the attribute key and the text after the colon; encode/2 returns that text. Used by webrtc_sdp_attr.

Summary

Types

raw holds the parameter text as received when it differs from the canonical k=v;k=v form. It is written back while it still parses to params, so unmodified input round trips byte exact.

A parameter is Key=Value or a bare value such as 0-15.

Functions

Parse the parameter text of an fmtp line. Parameters are separated by ; with optional surrounding spaces; empty parameters are skipped.

Types

direction/0

-type direction() :: sendrecv | sendonly | recvonly | inactive.

extmap/0

-type extmap() ::
          #{id := 1..255 | 4096..4351,
            direction := direction() | undefined,
            uri := binary(),
            attributes := binary() | undefined}.

fmtp/0

-type fmtp() :: #{fmt := pt() | binary(), params := [fmtp_param()], raw => binary()}.

fmtp_param/0

-type fmtp_param() :: {binary(), binary()} | binary().

raw holds the parameter text as received when it differs from the canonical k=v;k=v form. It is written back while it still parses to params, so unmodified input round trips byte exact.

msid/0

-type msid() :: #{stream := binary(), track := binary() | undefined}.

msid_semantic/0

-type msid_semantic() :: #{semantic := binary(), ids := [binary()], raw => binary()}.

pt/0

-type pt() :: 0..127.

rtcp_fb/0

-type rtcp_fb() :: #{pt := pt() | '*', type := binary(), param := binary() | undefined}.

rtpmap/0

-type rtpmap() ::
          #{pt := pt(),
            name := binary(),
            clock_rate := pos_integer(),
            channels := pos_integer() | undefined}.

A parameter is Key=Value or a bare value such as 0-15.

ssrc/0

-type ssrc() :: #{ssrc := 0..4294967295, attribute := binary(), value := binary() | undefined}.

ssrc_group/0

-type ssrc_group() :: #{semantics := binary(), ssrcs := [0..4294967295]}.

Functions

encode(Key, M)

-spec encode(atom(), term()) -> iodata().

encode_fmtp_params(Params)

-spec encode_fmtp_params([fmtp_param()]) -> binary().

parse(Key, V)

-spec parse(atom(), binary()) -> {ok, term()} | error.

parse_fmtp_params(Raw)

-spec parse_fmtp_params(binary()) -> {ok, [fmtp_param()]} | error.

Parse the parameter text of an fmtp line. Parameters are separated by ; with optional surrounding spaces; empty parameters are skipped.