webrtc_nack_buffer (webrtc v0.1.0)
View SourceSender-side retransmission buffer for NACK (RFC 4585 §6.2.1, RFC 4588).
A bounded ring indexed by RTP sequence number: storing packet Seq overwrites the slot Seq rem Size, so the buffer keeps at most the last size packets. retransmit/3 returns the stored packets for a list of NACK'd sequence numbers, skipping packets that are older than max_age or were already resent less than one RTT ago (a NACK sent before our retransmission arrived). Times are integers in milliseconds.
Summary
Functions
Number of stored packets.
Options: size (default 1024 packets), max_age in ms (default 2000) and the initial rtt in ms (default 0).
Packets to resend for Seqs, in request order.
Store a sent packet (any term, usually the encoded RTP packet).
Types
Functions
-spec count(buffer()) -> non_neg_integer().
Number of stored packets.
-spec new(#{size => pos_integer(), max_age => pos_integer() | infinity, rtt => non_neg_integer()}) -> buffer().
Options: size (default 1024 packets), max_age in ms (default 2000) and the initial rtt in ms (default 0).
Packets to resend for Seqs, in request order.
-spec set_rtt(non_neg_integer(), buffer()) -> buffer().
Store a sent packet (any term, usually the encoded RTP packet).