#[non_exhaustive]pub enum RetransmissionRateLimit {
WithinTarget,
UpToTarget,
Unlimited,
}Expand description
How the NACK responder holds its retransmissions to the congestion controller’s target
(RFC 4588 section 7), read from Attribute::TargetBitrateChanged as it passes on the read
leg. Until a target has passed, and in a chain without a congestion controller, nothing is
held back.
The rate is counted over the last RETRANSMISSION_RATE_WINDOW. A NACKed packet that
does not fit now waits, oldest request first, and leaves when the window has room for it
(poll_timeout is that instant), for as long as the
receiver keeps asking for it (PENDING_REQUEST_LIFETIME). Section 7 lets the sender
“selectively retransmit only the packets that it deems important and ignore NACK messages
for other packets in order to limit the bitrate”: a packet still asked for is the one
deemed important, one the receiver stopped asking for is dropped.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WithinTarget
RFC 4588 section 7, both halves: “the acceptable packet rate and bitrate include both the original and retransmitted data”, and “the sender SHOULD NOT send retransmission packets without reducing the packet rate and bitrate of the original stream (for example, by encoding the data at a lower rate)”.
Retransmissions take what the original packets of every local stream leave of the
target. While retransmissions wait or were sent within the window, the target reported
for the original media is the congestion controller’s less a retransmission
reserve: on the read leg Attribute::TargetBitrateChanged is lowered by it on its
way to the application, and RetransmissionReserve rides down the write leg to the
congestion controller, whose handle (GccHandle::target_bitrate_bps,
CongestionControlHandle::target_bitrate) reports the lowered target and keeps the
estimate itself readable (estimate_bps, estimate_bitrate). An encoder that follows
the target leaves the reserve free, so the repairs have room.
The reserve is what the waiting requests need to leave within about one round trip
(their octets over the round-trip time the RTCP session measured, at most
RETRANSMISSION_RATE_WINDOW), or the retransmission rate of the window when that is
more, and never more than MAX_RETRANSMISSION_RESERVE of the target
(NackResponderBuilder::with_max_reserve_fraction). It is released as the requests
are served and the retransmissions leave the window: with nothing waiting and nothing
retransmitted within the last window it is zero.
At the congestion controller’s floor. The controller’s minimum bit rate is this
engine’s setting, not the RFC’s, and the controller announces it with its target
(MinimumTarget). The original media is never told less than that minimum (the least
the application set its media to need). When lowering the original media by the reserve
would take it under that floor (target − reserve < minimum), it cannot make the room:
an encoder at its own minimum already fills the floor (in the capacity-cap test, 30
kbit/s of video and 80 kbit/s of audio against a 100 kbit/s target), and the rule above
would leave the repairs nothing for as long as the estimate stays near the floor. There
the retransmissions of packets still asked for take the window’s room first: they may
send up to the target within the window, whatever the original packets took, and the
original media is told the target less the reserve. Section 7 lets the sender
“selectively retransmit only the packets that it deems important”; a packet still asked
for is the one deemed important. An application at its minimum adds its own excess
over the floor; the retransmissions never go over the target.
What holds the sum on the wire when the application ignores the lowered target: with a pacer in the chain (the default interceptor set) the pacer sends at the controller’s target, retransmissions and media alike; without one (a chain of NACK, TWCC and GCC alone) it is this rule: above the floor the retransmissions take only what the original packets leave, so the engine never adds to an application’s excess; near the floor (target under the minimum plus the reserve, at most twice the minimum with the default reserve) they take at most the target.
UpToTarget
A rate limiter on the retransmissions alone, its maximum the target (the form of
libwebrtc’s RtpSender when it is given a retransmission_rate_limiter,
modules/rtp_rtcp/source/rtp_sender.cc): the retransmissions stay under the target
whatever the original packets take, and the target reported for the original media is
not lowered, so the sum may reach twice the target. A setting in no behaviour profile:
libwebrtc gives its video senders no such limiter (call/rtp_video_sender.cc:292-354
at a222406d; rtp_rtcp_interface.h:92 defaults it to null) and lowers the encoder
target by the protection share instead. Measured in
tests/capacity_cap_video_rtc2rtc.rs against the default: longest freeze 0.84 to
1.29 s against 0.83 to 1.24 s, 17 to 27 retransmissions dropped at the capped link
against 14 to 17.
Unlimited
No limit beyond the per-stream budget (one retransmission per original packet sent): the fork’s behaviour before. Retransmissions are then not congestion controlled.