webrtc_rtcp_ccfb (webrtc v0.1.0)

View Source

RTP Control Protocol feedback for congestion control (RFC 8888), RTPFB FMT 11.

The packet is the sender SSRC, one report block per RTP stream and a 32-bit report timestamp (middle bits of an NTP time). Each report block holds the stream SSRC, begin_seq, num_reports and one 16-bit metric per packet: R (received), ECN (2 bits) and the arrival time offset in 1/1024 s before the report timestamp (13 bits). An odd number of metrics is followed by 16 bits of zero padding.

num_reports is the number of metric blocks, covering begin_seq up to but not including begin_seq + num_reports, as clarified by the reported erratum on §3.1 and implemented by libwebrtc. A report block MUST NOT carry more than 16384 metrics; longer blocks are rejected on decode and on encode. Metrics with R = 0 decode to not_received and their ECN and ATO bits are ignored, as required.

Summary

Functions

Arrival time offset field for a packet that arrived OffsetUs microseconds before the report timestamp: 1/1024 s units, 0x1FFE when over range and 0x1FFF when the packet arrived after the report time (RFC 8888 §3.1).

Decode the body of a CCFB packet (after the common header).

Encode a CCFB packet body (everything after the common header).

Types

metric/0

-type metric() :: not_received | {0..3, 0..8191}.

rtcp_u32/0

-type rtcp_u32() :: 0..4294967295.

Functions

ato(OffsetUs)

-spec ato(integer()) -> 0..8191.

Arrival time offset field for a packet that arrived OffsetUs microseconds before the report timestamp: 1/1024 s units, 0x1FFE when over range and 0x1FFF when the packet arrived after the report time (RFC 8888 §3.1).

decode(_)

-spec decode(binary()) ->
                {ok,
                 #rtcp_ccfb{sender_ssrc :: rtcp_u32(),
                            reports :: [{rtcp_u32(), 0..65535, [not_received | {0..3, 0..8191}]}],
                            timestamp :: rtcp_u32()}} |
                {error, term()}.

Decode the body of a CCFB packet (after the common header).

encode(Rtcp_ccfb)

-spec encode(#rtcp_ccfb{sender_ssrc :: rtcp_u32(),
                        reports :: [{rtcp_u32(), 0..65535, [not_received | {0..3, 0..8191}]}],
                        timestamp :: rtcp_u32()}) ->
                binary().

Encode a CCFB packet body (everything after the common header).