webrtc_circuit_breaker (webrtc v0.1.0)
View SourceRTP media circuit breakers (RFC 8083 §4), as a sans-IO engine.
Streams are identified by an opaque key (the media session uses the mid). sent/4 records every RTP packet sent, report/5 every RTCP report block about the stream, with the round-trip time when known. Three breakers are implemented; each reports {circuit_breaker, Key, Reason} once when it triggers, and is re-armed when the condition clears:
rtcp_timeout(§4.1): packets were sent but no report block arrived forrtcp_timeoutms, three times the deterministic reporting interval with Tmin = 5 s (default 15000).media_timeout(§4.2): MEDIA_TIMEOUT consecutive reports show a non-increasing extended highest sequence number while packets were sent, MEDIA_TIMEOUT = ceil(k x max(Tr, Tdr) / Tdr) with k = 5. The frame interval Tf is not known to this layer and is left out.congestion(§4.3): over the last CB_INTERVAL reports (fraction lost weighted by the reporting intervals), the sending rate is more than ten times the simplified TCP throughput X = s / (Tr sqrt(2 b p / 3)) with b = 1. CB_INTERVAL = ceil(3 min(max(10 Tr, 3 Tdr), max(15, 3 Td)) / (3 Tdr)), the 10 G Tf term being unknown. Only checked when the RTT is known and a packet was sent in every reporting interval.
RFC 8083 says the sender SHOULD then cease transmission: this module detects, webrtc_cc acts (rate cut by ten then halt for congestion, halt for the timeouts).
Summary
Functions
RFC 8083 §4.3: after the sender cut its rate by ten, the congestion breaker is evaluated afresh over the next CB_INTERVAL reports; a new trigger then means the sender must cease.
Types
Functions
RFC 8083 §4.3: after the sender cut its rate by ten, the congestion breaker is evaluated afresh over the next CB_INTERVAL reports; a new trigger then means the sender must cease.
-spec sent(term(), non_neg_integer(), integer(), state()) -> state().