webrtc_rtcp_fb (webrtc v0.1.0)
View SourceRTCP feedback messages (RFC 4585 §6): transport layer (RTPFB, PT 205) and payload specific (PSFB, PT 206).
RTPFB: generic NACK (FMT 1, RFC 4585 §6.2.1), TMMBR and TMMBN (FMT 3 and 4, RFC 5104 §4.2), PAUSE-RESUME (FMT 9, RFC 7728 §8), RFC 8888 congestion control feedback (FMT 11, webrtc_rtcp_ccfb) and transport-wide CC feedback (FMT 15, webrtc_rtcp_twcc).
PSFB: PLI (FMT 1), SLI (FMT 2), FIR (FMT 4, RFC 5104 §4.3.1) and REMB (FMT 15 with the "REMB" identifier, draft-alvestrand-rmcat-remb).
Other formats decode to #rtcp_raw{}. This module is called by webrtc_rtcp; use that module to decode and encode packets. The NACK helpers nack_items/1 and nack_seqs/1 convert between sequence number lists and PID/BLP pairs.
Summary
Functions
Split a bitrate into a 6-bit exponent and a Bits-bit mantissa with the smallest exponent that fits (RFC 5104 §4.2.1.1). Bits below the mantissa precision are dropped, so the encoded value never exceeds the given bitrate.
Turn a list of lost sequence numbers into generic NACK items (PID and a bitmask of the 16 following packets). The list may wrap around 65535; order is taken relative to the first element.
Expand NACK items into the sequence numbers they request, in item order.
Functions
-spec bitrate_exp(non_neg_integer(), pos_integer()) -> {0..63, non_neg_integer()}.
Split a bitrate into a 6-bit exponent and a Bits-bit mantissa with the smallest exponent that fits (RFC 5104 §4.2.1.1). Bits below the mantissa precision are dropped, so the encoded value never exceeds the given bitrate.
-spec decode(205 | 206, 0..31, binary()) -> {ok, webrtc_rtcp:packet()} | {error, term()}.
-spec encode(webrtc_rtcp:packet()) -> {0..31, 205 | 206, iodata()}.
-spec nack_items([0..65535]) -> [{0..65535, 0..65535}].
Turn a list of lost sequence numbers into generic NACK items (PID and a bitmask of the 16 following packets). The list may wrap around 65535; order is taken relative to the first element.
-spec nack_seqs([{0..65535, 0..65535}]) -> [0..65535].
Expand NACK items into the sequence numbers they request, in item order.