pre-flight: bandwidth test + persistent config
First-run host launch now offers a one-time upstream measurement against speed.cloudflare.com/__up via ureq (~5 MB POST, ~5s). The result lives at ~/.config/pixelpass/config.toml under [bandwidth] and feeds the default --max-viewers calculation on subsequent runs. Sticky semantics for the dialog: - Unmeasured: first-run prompt (Run / Skip) - Measured / Skipped: silent — never re-prompts - Failed: ask again on next launch (Retry / give up → Skipped) `pixelpass --reconfigure` re-runs the test unconditionally for users whose connection has changed (new ISP, moved house, etc.). --max-viewers is now Option<u32>. When unset, host startup loads the saved measurement, runs recommended_max_viewers(safe_mbps, bitrate), and surfaces the source in the banner: "max viewers : N (auto: X.X Mbps measured upstream)" — or user-specified / default fallback. User verified end-to-end on 2026-05-21 16:54 EDT: first-run dialog, skip path, run path, --reconfigure refresh, and banner integration all work as expected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+12
-4
@@ -46,9 +46,11 @@ pub struct Cli {
|
||||
pub low_latency: bool,
|
||||
|
||||
/// Maximum number of concurrent viewers. Additional connections are
|
||||
/// politely refused with a "host full" message.
|
||||
#[arg(long, default_value_t = 2)]
|
||||
pub max_viewers: u32,
|
||||
/// politely refused with a "host full" message. Defaults to the
|
||||
/// connection-aware recommendation from the bandwidth pre-flight if
|
||||
/// available, otherwise 2.
|
||||
#[arg(long)]
|
||||
pub max_viewers: Option<u32>,
|
||||
|
||||
// ── viewer options ────────────────────────────────────────────────
|
||||
/// Local TCP port for the viewer to expose (default: random).
|
||||
@@ -63,6 +65,12 @@ pub struct Cli {
|
||||
/// Clean up orphaned PipeWire state from a crashed host run, then exit.
|
||||
#[arg(long)]
|
||||
pub repair: bool,
|
||||
|
||||
/// Re-run the bandwidth pre-flight test, save the result, then exit.
|
||||
/// Use this if your connection has changed (new ISP, moved house, etc.)
|
||||
/// or if the previously saved test result is stale.
|
||||
#[arg(long)]
|
||||
pub reconfigure: bool,
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Clone, Copy, Debug)]
|
||||
@@ -81,7 +89,7 @@ pub struct HostOpts {
|
||||
pub framerate: u32,
|
||||
pub no_hwencode: bool,
|
||||
pub low_latency: bool,
|
||||
pub max_viewers: u32,
|
||||
pub max_viewers: Option<u32>,
|
||||
pub interactive: bool,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user