Skip to main content

Module livecc

Module livecc 

Source
Expand description

SRT Live Congestion Control — packet pacing (draft-sharabayko-srt-01 §5.1, curated at specs/rules/srt-livecc.md).

A sans-IO, no_std sender-side pacing controller that computes the minimum inter-packet send period (PKT_SND_PERIOD) from a configured maximum bandwidth (MAX_BW) and a running EWMA of the average payload size (AvgPayloadSize).

§Usage

use srt_runtime::livecc::{LiveCC, MaxBwConfig};
use core::time::Duration;

let mut cc = LiveCC::new(Default::default());
// Application sends a data packet with 1316 bytes of payload:
cc.on_data_packet(1316);
// On ACK reception, recompute the send period:
let period = cc.on_ack_received();
assert!(period > Duration::ZERO);

§Spec grounding

  • specs/rules/srt-livecc.md §5.1.1 — MAX_BW configuration modes (§5.1.1, lines L3116-L3202).
  • specs/rules/srt-livecc.md §5.1.2 — LiveCC algorithm (lines L3203-L3238):
    • EWMA formula: L3219 (AvgPayloadSize = 7/8 * AvgPayloadSize + 1/8 * PacketPayloadSize)
    • Initial value cap: L3222-3223 (max 1456 bytes).
    • PktSize formula: L3227-3229 (PktSize = AvgPayloadSize + SRT header size).
    • PKT_SND_PERIOD formula: L3234 (PktSize * 1000000 / MAX_BW).
  • specs/rules/srt-livecc.md — SYN = 0.01 s (imported from §5.2.1, L3421-3423, restated at L197-L199 of the curated doc).

Structs§

LiveCC
SRT Live Congestion Control — sender-side pacing state (draft-sharabayko-srt-01 §5.1.2).

Enums§

MaxBwConfig
Maximum bandwidth configuration mode (specs/rules/srt-livecc.md §5.1.1, lines L3116-L3202).