Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:
run: nix develop --command just test ts --headroom --rate 7000000 --queue 250ms --duration 120
env:
HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs
MOQ_QUIC_CONGESTION_CONTROL: loss
MOQ_QUIC_CONGESTION_CONTROL: cubic

# Passthrough over the overflowing path, under its 10 Mb/s multiplex: what arrives must be
# the source's packets in place, through the source's last packet.
Expand All @@ -253,7 +253,7 @@ jobs:
run: nix develop --command just test ts --passthrough --rate 7000000 --queue 250ms --duration 120
env:
HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs
MOQ_QUIC_CONGESTION_CONTROL: loss
MOQ_QUIC_CONGESTION_CONTROL: cubic

# Two minutes of MoQ content faults and a congested bottleneck, on a paused clock: each
# recovery graded against what was delivered and decoded, and the latency must not drift.
Expand Down
28 changes: 15 additions & 13 deletions cpp/obs/src/moq-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,10 @@ const std::vector<Field> &Fields()
"forever. A first connect that reaches no server fails the stream at once."));

// QUIC transport.
f.push_back(Choose(
QUIC_CONGESTION_CONTROL, "Congestion control",
{{"Automatic", AUTO}, {"Delay-based (BBR)", "delay"}, {"Loss-based (CUBIC)", "loss"}}, false,
"Delay-based keeps queues short and the send rate steady enough for an "
"encoder to track. Loss-based chases throughput instead."));
f.push_back(Choose(QUIC_CONGESTION_CONTROL, "Congestion control",
{{"Automatic", AUTO}, {"BBR", "bbr"}, {"CUBIC", "cubic"}}, false,
"BBR, the default, keeps queues short and the send rate steady enough for an "
"encoder to track. CUBIC chases throughput instead."));
f.push_back(Number(QUIC_MAX_STREAMS, "Max concurrent streams",
static_cast<long long>(d.quic.max_streams.value_or(0)), 1, 65536, 1,
"MoQ opens a stream per group, so a busy publisher wants this high."));
Expand Down Expand Up @@ -346,15 +345,18 @@ std::string Configure(obs_data_t *settings, moq::ClientConfig &config)
if (const auto timeout = Milliseconds(settings, BACKOFF_TIMEOUT, error); timeout.count() != 0)
config.backoff.timeout = timeout;

// Automatic leaves the tri-states and the congestion family unset, which keeps the
// transport free to pick.
if (const char *family = OptionalString(settings, QUIC_CONGESTION_CONTROL)) {
if (strcmp(family, "delay") == 0)
config.quic.congestion_control = moq::CongestionControl::delay();
else if (strcmp(family, "loss") == 0)
config.quic.congestion_control = moq::CongestionControl::loss();
// Automatic leaves the tri-states and the congestion control unset, which keeps the
// library default. A scene saved with a released family name (`delay`, `loss`) is
// refused rather than mapped, and the message tells the user how to fix it.
if (const char *algorithm = OptionalString(settings, QUIC_CONGESTION_CONTROL)) {
if (strcmp(algorithm, "bbr") == 0)
config.quic.congestion_control = moq::CongestionControl::bbr();
else if (strcmp(algorithm, "cubic") == 0)
config.quic.congestion_control = moq::CongestionControl::cubic();
else
Refuse(error, std::string("unknown congestion control: ") + family);
Refuse(error, std::string("congestion control '") + algorithm +
"' is not supported: pick BBR or CUBIC for Congestion control in "
"the output's Advanced settings");
}
config.quic.max_streams = Amount(settings, QUIC_MAX_STREAMS, error);
config.quic.idle_timeout = Milliseconds(settings, QUIC_IDLE_TIMEOUT, error);
Expand Down
15 changes: 9 additions & 6 deletions cpp/obs/test/moq-settings-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int main()
settings.ints["connect_timeout_ms"] = 7000;
settings.ints["failover_delay_ms"] = 80;
settings.strings["tls_host_name"] = "relay.example";
settings.strings["quic_congestion_control"] = "loss";
settings.strings["quic_congestion_control"] = "cubic";
settings.ints["quic_idle_timeout_ms"] = 9000;
settings.ints["quic_keep_alive_ms"] = 0;
settings.strings["quic_gso"] = "off";
Expand All @@ -193,7 +193,7 @@ int main()
CHECK(config.race == std::chrono::milliseconds(80));
CHECK(config.tls.host_name == std::string("relay.example"));
CHECK(config.quic.congestion_control);
CHECK(config.quic.congestion_control->eq(moq::CongestionControl::loss()));
CHECK(config.quic.congestion_control->eq(moq::CongestionControl::cubic()));
CHECK(config.quic.idle_timeout == std::chrono::milliseconds(9000));
CHECK(config.quic.keep_alive == std::chrono::nanoseconds::zero());
CHECK(config.quic.gso == false);
Expand Down Expand Up @@ -234,14 +234,17 @@ int main()
}
printf("key log is opt-in: ok\n");

// A hand-edited scene collection naming an unknown family refuses rather than ignores it.
{
// A hand-edited scene collection naming an unknown algorithm, or one saved with a
// released family name, refuses rather than ignores it.
for (const char *algorithm : {"fast", "delay", "loss"}) {
obs_data settings;
MoQSettings::Defaults(&settings);
settings.bools["advanced"] = true;
settings.strings["quic_congestion_control"] = "fast";
settings.strings["quic_congestion_control"] = algorithm;
moq::ClientConfig config;
CHECK(MoQSettings::Configure(&settings, config).find("congestion") != std::string::npos);
const std::string refused = MoQSettings::Configure(&settings, config);
CHECK(refused.find(algorithm) != std::string::npos);
CHECK(refused.find("pick BBR or CUBIC") != std::string::npos);
}
printf("unknown congestion control refused: ok\n");

Expand Down
6 changes: 3 additions & 3 deletions dart/moq/lib/src/aliases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ typedef Request = MoqRequest;
/// The network transport carrying an incoming session.
typedef Transport = MoqTransport;

/// The congestion control family for a QUIC connection. Build one with
/// `CongestionControl.delay()`, `.loss()`, or `.none()`; a new algorithm joins as
/// a new constructor.
/// The congestion control algorithm for a QUIC connection. Build one with
/// `CongestionControl.bbr()`, `.cubic()`, or `.unlimited()`; a new algorithm joins
/// as a new constructor named after it.
typedef CongestionControl = MoqCongestionControl;

/// Certificate trust and the mTLS identity for `ConnectOptions.tls`.
Expand Down
2 changes: 1 addition & 1 deletion dart/moq/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ final class QuicConfig {
/// Path MTU discovery; null leaves the choice to the backend.
final bool? mtuDiscovery;

/// The congestion control family; null leaves the choice to the backend.
/// The congestion control algorithm; null runs BBR v3.
final CongestionControl? congestionControl;

/// Directory, which must exist, to write qlog traces into.
Expand Down
2 changes: 1 addition & 1 deletion dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ void main() {
keepAlive: Duration.zero,
gso: false,
mtuDiscovery: true,
congestionControl: CongestionControl.loss(),
congestionControl: CongestionControl.cubic(),
keylog: false,
),
once: true,
Expand Down
6 changes: 3 additions & 3 deletions doc/bin/relay/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Transport tuning, applied to accepted and dialed connections alike.

```toml
[quic]
congestion_control = "delay" # "delay" (BBR v3, the default), "loss" (CUBIC), or "none".
congestion_control = "bbr" # "bbr" (BBR v3, the default), "cubic", or "unlimited".
max_streams = 10000 # Concurrent streams per connection, bidi and uni; 0 is refused. Default.
idle_timeout = "10s" # Drop a connection after this long with nothing on it. Default.
# keep_alive = "3s" # Ping interval; unset or "0s" derives it from the idle timeout.
Expand All @@ -123,8 +123,8 @@ qlog = "/var/log/moq/qlog" # Existing directory.
# keylog = "/private/keys.log" # Explicit secret log path; unset is off.
```

`congestion_control = "none"` runs no congestion control and no pacing. It is
meant for tests and controlled links, where nothing else shares the path.
`congestion_control = "unlimited"` runs no congestion control and no pacing. It
is meant for tests and controlled links, where nothing else shares the path.

Set `keylog` only while debugging, since the file decrypts every captured session.
Tokio and io\_uring open the configured path at initialization. New Unix files are
Expand Down
2 changes: 1 addition & 1 deletion go/wrapper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type QUICConfig struct {
GSO *bool
// MTUDiscovery toggles path MTU discovery.
MTUDiscovery *bool
// CongestionControl picks the congestion control family; nil leaves the choice to the backend.
// CongestionControl picks the congestion control algorithm; nil runs BBR v3.
CongestionControl *CongestionControl
// Qlog is a directory, which must exist, to write qlog traces into.
Qlog string
Expand Down
2 changes: 1 addition & 1 deletion go/wrapper/reconnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestDialConnectionOptions(t *testing.T) {
KeepAlive: ptr(time.Duration(0)),
GSO: ptr(false),
MTUDiscovery: ptr(true),
CongestionControl: moq.LossCongestionControl(),
CongestionControl: moq.CubicCongestionControl(),
},
WebSocket: moq.WebSocketConfig{Enabled: ptr(false)},
})
Expand Down
24 changes: 12 additions & 12 deletions go/wrapper/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type (
AudioSampleFormat = ffi.MoqAudioSampleFormat
// AudioFrame is one audio frame: PCM payload plus a presentation Timestamp.
AudioFrame = ffi.MoqAudioFrame
// CongestionControl is the congestion control family for a QUIC connection. Build one with
// DelayCongestionControl, LossCongestionControl, or NoneCongestionControl; a new algorithm
// joins as a new builder.
// CongestionControl is the congestion control algorithm for a QUIC connection. Build one with
// BBRCongestionControl, CubicCongestionControl, or UnlimitedCongestionControl; a new algorithm
// joins as a new builder named after it.
CongestionControl = ffi.MoqCongestionControl
// ErrorScope is whether a protocol code is from the session or stream registry.
ErrorScope = ffi.MoqErrorScope
Expand Down Expand Up @@ -170,19 +170,19 @@ func DeflateCompression() *Compression {
return ffi.MoqCompressionDeflate()
}

// LossCongestionControl is loss-based (CUBIC): it chases throughput, so the send rate sawtooths.
func LossCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlLoss()
// BBRCongestionControl is BBR v3, the default: it keeps queues short and the send rate steady.
func BBRCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlBbr()
}

// DelayCongestionControl is delay-based (BBR v3), the default: it keeps queues short and the send rate steady.
func DelayCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlDelay()
// CubicCongestionControl is CUBIC: it chases throughput, so the send rate sawtooths.
func CubicCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlCubic()
}

// NoneCongestionControl runs no congestion control and no pacing, for tests and controlled links.
func NoneCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlNone()
// UnlimitedCongestionControl runs no congestion control and no pacing, for tests and controlled links.
func UnlimitedCongestionControl() *CongestionControl {
return ffi.MoqCongestionControlUnlimited()
}

// ParseInstance names an instance with text, failing with ErrInvalidInstance when it is empty.
Expand Down
4 changes: 2 additions & 2 deletions kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Aliases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ typealias ServerTls = uniffi.moq.MoqServerTls
typealias QuicConfig = uniffi.moq.MoqQuicConfig

/**
* The congestion control family for a QUIC connection. Build one with `CongestionControl.delay()`,
* `loss()`, or `none()`; a new algorithm joins as a new constructor.
* The congestion control algorithm for a QUIC connection. Build one with `CongestionControl.bbr()`,
* `cubic()`, or `unlimited()`; a new algorithm joins as a new constructor named after it.
*/
typealias CongestionControl = uniffi.moq.MoqCongestionControl

Expand Down
2 changes: 1 addition & 1 deletion kt/moq/src/jvmAndAndroidTest/kotlin/dev/moq/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class SmokeTest {
assertNotNull(defaults.timeout)
assertNull(defaults.quic.congestionControl)
assertTrue(versions().isNotEmpty())
val congestion: CongestionControl = CongestionControl.delay()
val congestion: CongestionControl = CongestionControl.bbr()
assertEquals(congestion, QuicConfig(congestionControl = congestion).congestionControl)
// Dialing with the reported defaults is the same as dialing with none.
Client(defaults).close()
Expand Down
2 changes: 1 addition & 1 deletion py/moq-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ client = moq.Client(
- `fingerprints`. Hex SHA-256 fingerprint(s) to pin the peer's certificate to, the native equivalent of `serverCertificateHashes`. Accepts the values a server reports via `cert_fingerprints()`, so you can trust a self-signed certificate without `insecure=True`.
- `cert`, `key`. Paired PEM certificate chain and private key paths for mTLS.
- `host_name`. Verify the certificate against this name (SNI) instead of the URL's host.
- `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`, such as `CongestionControl.delay()`), and `qlog` (a trace directory, which must exist). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build.
- `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`: `CongestionControl.bbr()`, `.cubic()`, or `.unlimited()`), and `qlog` (a trace directory, which must exist). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build.
- `websocket=WebSocketConfig(...)`. The fallback raced against QUIC: `enabled=False` turns it off, and `delay` is QUIC's head start.
- `once`, `backoff`. Redial with a `Backoff` when the transport drops; `once=True` dials once.
- `.session`. The connecting or connected `Session` (or `None` before entering / after exit).
Expand Down
4 changes: 2 additions & 2 deletions py/moq-rs/moq/_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ class QuicConfig:
``max_streams`` caps the concurrent streams the peer may open toward this endpoint
(0 is refused); MoQ opens one per group, so a subscriber to many tracks wants it
raised. ``idle_timeout`` is how long an idle connection survives, and ``keep_alive``
the ping interval (zero uses the default). ``gso``, ``mtu_discovery``, and
``congestion_control`` leave the choice to the backend when ``None``. ``qlog`` is a
the ping interval (zero uses the default). ``gso`` and ``mtu_discovery`` leave the
choice to the backend when ``None``, and a ``None`` ``congestion_control`` runs BBR v3. ``qlog`` is a
directory, which must exist, for qlog traces.
``keylog=True`` writes TLS session secrets to the file ``SSLKEYLOGFILE`` names, for
decrypting a capture; without ``SSLKEYLOGFILE`` the client refuses to build.
Expand Down
2 changes: 1 addition & 1 deletion py/moq-rs/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ async def accept_loop() -> None:
keep_alive=timedelta(0),
gso=False,
mtu_discovery=True,
congestion_control=moq.CongestionControl.loss(),
congestion_control=moq.CongestionControl.cubic(),
keylog=False,
),
websocket=moq.WebSocketConfig(enabled=False),
Expand Down
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ removal, a rename, or a wire, catalog, or format change that is free until
demos return to their earlier format.
- **Unused API.** [One sweep per area](/quest/m2/unused-api/README.md), each
item re-checked for a downstream caller first.
- **Relay and transports.** [Congestion names](/quest/m2/congestion-names.md).
- **Auth and crypto.** End-to-end encryption is its own unpublished crate again
([moq-dev/moq#8947](https://github.com/moq-dev/moq/pull/8947)); its
[finished format](/quest/m3/e2ee-format.md) follows in m3.
Expand Down
Loading