Compare commits

...

11 Commits

Author SHA1 Message Date
mnovak c7dcdc80f3 [domistream] Video packetizer: even FEC block split; control host: refused input names its type; PROTOCOL 5.2/5.3 host facts (S-26); version 0.2.2 2026-12-04 15:49:04 +01:00
mnovak a78bde9037 [domistream] Control host: test first, a refused INPUT_DATA names its input type 2026-12-04 15:47:21 +01:00
mnovak 90c49c4041 [domistream] Video packetizer: tests first, FEC blocks split evenly, larger blocks first (RFC 5052 9.1) 2026-12-04 15:47:15 +01:00
mnovak 28750eee81 [repo] Merge: docs/l2-measured (L2 demo measurement, PR #17) 2026-12-04 15:30:49 +01:00
mnovak 597484425e [repo] Docs: L2 demo measurement of Arena Domi Remote against lumen-host (RTSP read-to-close, ANNOUNCE attributes) [L1] 2026-12-04 15:29:58 +01:00
mnovak 0d45628c4e [repo] Merge: release/stream-v0.2.1 (stream-v0.2.1, PR #16) 2026-12-04 14:29:18 +01:00
mnovak 25557d4c38 [repo] Release: version 0.2.1 (empty-body START_B, PERIODIC_PING, IDR request), handover 2026-12-04 14:29:10 +01:00
mnovak 9434d16422 [repo] Merge: feature/control-empty-bodies (empty-body START_B, PERIODIC_PING, IDR request, PR #15) 2026-12-04 13:46:32 +01:00
mnovak 4300b6b7fb [domistream] Control: START_B, PERIODIC_PING and the IDR request with empty bodies (PROTOCOL.md 3.3); START_A stays refused 2026-12-04 13:46:12 +01:00
mnovak 66679229db [domistream] Control: tests first, START_B, PERIODIC_PING and the IDR request with empty bodies (START_A stays refused) 2026-12-04 13:45:04 +01:00
mnovak 51db5a962b [repo] Merge: feature/host-session (session test, fixes, mutation, L1 measurement, 0.2.0, PR #14) 2026-12-04 13:40:12 +01:00
14 changed files with 140 additions and 48 deletions
Generated
+1 -1
View File
@@ -241,7 +241,7 @@ dependencies = [
[[package]] [[package]]
name = "domistream" name = "domistream"
version = "0.2.0" version = "0.2.2"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",
+1 -1
View File
@@ -5,7 +5,7 @@ exclude = ["fuzz"]
resolver = "3" resolver = "3"
[workspace.package] [workspace.package]
version = "0.2.0" version = "0.2.2"
edition = "2024" edition = "2024"
rust-version = "1.89" rust-version = "1.89"
license = "CPAL-1.0" license = "CPAL-1.0"
+8 -1
View File
@@ -63,6 +63,9 @@ pub enum ClientControlMessage {
InputRejected { InputRejected {
/// Body length. /// Body length.
body_len: usize, body_len: usize,
/// The input type field (body bytes 4..8, little-endian, PROTOCOL.md 4) when the body is long enough: for the
/// logs, so a host can name what a client sends.
input_type: Option<u32>,
/// Why. /// Why.
error: Error, error: Error,
}, },
@@ -111,7 +114,11 @@ pub fn parse_client_message(message: &[u8]) -> Result<ClientControlMessage> {
t if t == MessageType::FrameStats as u16 => ClientControlMessage::FrameStats(b.to_vec()), t if t == MessageType::FrameStats as u16 => ClientControlMessage::FrameStats(b.to_vec()),
t if t == MessageType::InputData as u16 => match crate::input::parse_input(message) { t if t == MessageType::InputData as u16 => match crate::input::parse_input(message) {
Ok(e) => ClientControlMessage::Input(e), Ok(e) => ClientControlMessage::Input(e),
Err(error) => ClientControlMessage::InputRejected { body_len: b.len(), error }, Err(error) => ClientControlMessage::InputRejected {
body_len: b.len(),
input_type: b.get(4..8).and_then(|t| <[u8; 4]>::try_from(t).ok()).map(u32::from_le_bytes),
error,
},
}, },
other => ClientControlMessage::Unknown { message_type: other, body_len: b.len() }, other => ClientControlMessage::Unknown { message_type: other, body_len: b.len() },
}) })
+17 -10
View File
@@ -269,11 +269,11 @@ pub fn parse_host_message(message: &[u8]) -> Result<HostMessage> {
pub enum ClientMessage { pub enum ClientMessage {
/// `START_A` (body UNKNOWN U10). /// `START_A` (body UNKNOWN U10).
StartA, StartA,
/// `START_B` (body UNKNOWN U10): the host starts video and audio. /// `START_B`: the host starts video and audio. Sent with an empty body (PROTOCOL.md 3.3).
StartB, StartB,
/// Keep-alive (body UNKNOWN U10). /// Keep-alive, sent with an empty body (3.3).
PeriodicPing, PeriodicPing,
/// Ask for an IDR frame (body UNKNOWN U10). /// Ask for an IDR frame, sent with an empty body (3.3).
RequestIdrFrame, RequestIdrFrame,
/// Ask the host to stop referencing frames `first..=last`. /// Ask the host to stop referencing frames `first..=last`.
InvalidateRefFrames { InvalidateRefFrames {
@@ -289,8 +289,9 @@ pub enum ClientMessage {
/// Serializes a message to the host (type, length, body), ready for [`super::ControlCipher::seal`]. /// Serializes a message to the host (type, length, body), ready for [`super::ControlCipher::seal`].
/// ///
/// # Errors /// # Errors
/// [`crate::Error::Unsupported`] for a message whose body is still UNKNOWN (U10: START_A, START_B, /// [`crate::Error::Unsupported`] for START_A, whose body is still UNKNOWN (U10; refused rather than guessed);
/// PERIODIC_PING, IDR request; refused rather than guessed); input errors as [`crate::input::encode_input`]. /// input errors as [`crate::input::encode_input`]. START_B, PERIODIC_PING and the IDR request carry an empty body:
/// what Moonshine and Lumen read (PROTOCOL.md 3.3); whether Sunshine reads more is still U10.
pub fn encode_client_message(message: &ClientMessage) -> Result<Vec<u8>> { pub fn encode_client_message(message: &ClientMessage) -> Result<Vec<u8>> {
match message { match message {
ClientMessage::InvalidateRefFrames { first, last } => { ClientMessage::InvalidateRefFrames { first, last } => {
@@ -304,11 +305,17 @@ pub fn encode_client_message(message: &ClientMessage) -> Result<Vec<u8>> {
Ok(m) Ok(m)
} }
ClientMessage::Input(e) => crate::input::encode_input(e), ClientMessage::Input(e) => crate::input::encode_input(e),
ClientMessage::StartA ClientMessage::StartB => Ok(empty_body(MessageType::StartB)),
| ClientMessage::StartB ClientMessage::PeriodicPing => Ok(empty_body(MessageType::PeriodicPing)),
| ClientMessage::PeriodicPing ClientMessage::RequestIdrFrame => Ok(empty_body(MessageType::IdrFrame)),
| ClientMessage::RequestIdrFrame => { ClientMessage::StartA => Err(crate::Error::Unsupported { what: "START_A, whose body is still UNKNOWN (U10)" }),
Err(crate::Error::Unsupported { what: "a control message whose body is still UNKNOWN (U10)" })
} }
} }
/// A message of type `t` with a zero-length body: type and length (0), both little-endian (PROTOCOL.md 3.3).
fn empty_body(t: MessageType) -> Vec<u8> {
let mut m = Vec::with_capacity(4);
m.extend_from_slice(&(t as u16).to_le_bytes());
m.extend_from_slice(&0u16.to_le_bytes());
m
} }
+7 -7
View File
@@ -183,14 +183,14 @@ pub fn plan_fec_blocks(data_shards: usize, fec_percentage: u8, min_parity: u8) -
let blocks = (1..=MAX_FEC_BLOCKS) let blocks = (1..=MAX_FEC_BLOCKS)
.find(|&b| wished_percentage(data_shards.div_ceil(b), fec_percentage, min_parity).is_some()) .find(|&b| wished_percentage(data_shards.div_ceil(b), fec_percentage, min_parity).is_some())
.unwrap_or(MAX_FEC_BLOCKS); .unwrap_or(MAX_FEC_BLOCKS);
let k_full = data_shards.div_ceil(blocks); // Even split (RFC 5052 9.1, as a BSD-2 host does it; PROTOCOL.md 5.3): the first `r` blocks carry one shard
let count = data_shards.div_ceil(k_full); // more, so block sizes differ by at most one and the largest is `ceil(n / blocks)`, the size checked above.
let mut plan = Vec::with_capacity(count); let blocks = blocks.min(data_shards);
let mut left = data_shards; let (q, r) = (data_shards / blocks, data_shards % blocks);
while left > 0 { let mut plan = Vec::with_capacity(blocks);
let k = left.min(k_full); for i in 0..blocks {
let k = if i < r { q + 1 } else { q };
plan.push(block(k, fec_percentage, min_parity)?); plan.push(block(k, fec_percentage, min_parity)?);
left -= k;
} }
Ok(plan) Ok(plan)
} }
+11 -4
View File
@@ -381,11 +381,18 @@ fn client_messages() {
encode_client_message(&ClientMessage::Input(ev.clone())).unwrap(), encode_client_message(&ClientMessage::Input(ev.clone())).unwrap(),
domistream::input::encode_input(&ev).unwrap() domistream::input::encode_input(&ev).unwrap()
); );
// Bodies still UNKNOWN (U10) are refused rather than guessed. // START_B, PERIODIC_PING and the IDR request go with an empty body (PROTOCOL.md 3.3: what Moonshine and Lumen
for m in [ClientMessage::StartA, ClientMessage::StartB, ClientMessage::PeriodicPing, ClientMessage::RequestIdrFrame] // read; the lead's decision of 2026-12-04). START_A's body is still UNKNOWN (U10) and stays refused.
{ for (m, t) in [
assert_err!(encode_client_message(&m), Error::Unsupported { .. }, "{m:?}"); (ClientMessage::StartB, 0x0307u16),
(ClientMessage::PeriodicPing, 0x0200),
(ClientMessage::RequestIdrFrame, 0x0302),
] {
let mut want = t.to_le_bytes().to_vec();
want.extend_from_slice(&0u16.to_le_bytes());
assert_eq!(encode_client_message(&m).unwrap(), want, "{m:?}");
} }
assert_err!(encode_client_message(&ClientMessage::StartA), Error::Unsupported { .. });
} }
proptest! { proptest! {
+24
View File
@@ -784,3 +784,27 @@ proptest! {
prop_assert!(messages <= plains.len()); prop_assert!(messages <= plains.len());
} }
} }
/// Diagnostics (decision D2 on the host): an INPUT_DATA the host cannot read still says which input type it was, so
/// the black-box log can name what a real client sends (L2 demo: one 10-byte body of an unknown layout, U21).
#[test]
fn refused_input_names_its_type() {
// INPUT_DATA (0x0206): length 10, size (BE) 6 = type + 2 data bytes, type TOUCH 0x55000002 (LE), 2 data bytes.
let mut m = vec![0x06, 0x02, 10, 0];
m.extend_from_slice(&6u32.to_be_bytes());
m.extend_from_slice(&0x5500_0002u32.to_le_bytes());
m.extend_from_slice(&[0xAA, 0xBB]);
match parse_client_message(&m) {
Ok(ClientControlMessage::InputRejected { body_len, input_type, .. }) => {
assert_eq!(body_len, 10);
assert_eq!(input_type, Some(0x5500_0002));
}
other => panic!("{other:?}"),
}
// Too short to carry a type: none.
let short = vec![0x06, 0x02, 2, 0, 0, 0];
match parse_client_message(&short) {
Ok(ClientControlMessage::InputRejected { input_type, .. }) => assert_eq!(input_type, None),
other => panic!("{other:?}"),
}
}
+3 -2
View File
@@ -623,8 +623,9 @@ fn a_whole_session_between_our_client_and_our_host() {
(launched.mode.width, launched.mode.height, launched.mode.fps) (launched.mode.width, launched.mode.height, launched.mode.fps)
); );
// ENet connect on the control port, then START_B. ControlStream refuses START_B (body U10), hence the probe path. // ENet connect on the control port, then START_B. ControlStream sends START_B with an empty body (3.3); the
assert_err!(encode_client_message(&ClientMessage::StartB), Error::Unsupported { .. }); // session below drives the same bytes over EnetClient + ControlCipher, as gs-probe does.
assert_eq!(encode_client_message(&ClientMessage::StartB).unwrap(), vec![0x07, 0x03, 0x00, 0x00]);
let host_control = HostControl { let host_control = HostControl {
config: ControlHostConfig { config: ControlHostConfig {
enet: EnetHostConfig { enet: EnetHostConfig {
+15 -4
View File
@@ -438,16 +438,18 @@ fn fec_plan_properties() {
assert!((1..=MAX_FEC_BLOCKS).contains(&plan.len()), "{ctx}: {} blocks", plan.len()); assert!((1..=MAX_FEC_BLOCKS).contains(&plan.len()), "{ctx}: {} blocks", plan.len());
assert_eq!(plan.iter().map(|b| usize::from(b.data_shards)).sum::<usize>(), n, "{ctx}"); assert_eq!(plan.iter().map(|b| usize::from(b.data_shards)).sum::<usize>(), n, "{ctx}");
let first_k = plan[0].data_shards; let first_k = plan[0].data_shards;
// Even split (RFC 5052 9.1, as a BSD-2 host does it, PROTOCOL.md 5.3): sizes differ by at most one,
// the larger blocks first.
let q = n / plan.len();
let r = n % plan.len();
for (i, b) in plan.iter().enumerate() { for (i, b) in plan.iter().enumerate() {
let (k, m, p) = let (k, m, p) =
(usize::from(b.data_shards), usize::from(b.parity_shards), usize::from(b.fec_percentage)); (usize::from(b.data_shards), usize::from(b.parity_shards), usize::from(b.fec_percentage));
assert!(k >= 1 && k + m <= 255, "{ctx}: k {k} m {m}"); assert!(k >= 1 && k + m <= 255, "{ctx}: k {k} m {m}");
assert_eq!(m, parity_count(k, b.fec_percentage).unwrap(), "{ctx}: m follows from the percentage"); assert_eq!(m, parity_count(k, b.fec_percentage).unwrap(), "{ctx}: m follows from the percentage");
if i + 1 < plan.len() { let want = if i < r { q + 1 } else { q };
assert_eq!(b.data_shards, first_k, "{ctx}: every block but the last carries the same k"); assert_eq!(usize::from(b.data_shards), want, "{ctx}: block {i} of an even split");
} else {
assert!(b.data_shards <= first_k, "{ctx}"); assert!(b.data_shards <= first_k, "{ctx}");
}
let t = target(k, pct, min); let t = target(k, pct, min);
assert_eq!( assert_eq!(
b.reduced, b.reduced,
@@ -480,6 +482,15 @@ fn fec_plan_properties() {
); );
} }
#[test]
fn blocks_split_evenly_larger_first() {
// 217 shards at 255 %: at most 72 data shards fit a block (72 + 184 = 256 would not), so 4 blocks, split
// 55, 54, 54, 54 (RFC 5052 9.1), not 55, 55, 55, 52.
let plan = plan_fec_blocks(217, 255, 0).unwrap();
let ks: Vec<u16> = plan.iter().map(|b| b.data_shards).collect();
assert_eq!(ks, vec![55, 54, 54, 54]);
}
#[test] #[test]
fn minimum_parity_raises_the_written_percentage() { fn minimum_parity_raises_the_written_percentage() {
// One data shard at 0 % with at least 2 parity packets: 101 % is the smallest percentage giving // One data shard at 0 % with at least 2 parity packets: 101 % is the smallest percentage giving
+1
View File
@@ -97,3 +97,4 @@ All entries by the DomiStream protocol engineer. Pinned commits are the ones rea
| S-31 | 2026-12-04 | Moonshine at `f184d5e`: `src/session/stream/mod.rs`, `src/session/stream/video/mod.rs`; the repository tree listing (GitHub API) | BSD-2, facts only. `bitStreamFormat` 0 H.264 (default), 1 HEVC, 2 AV1, others invalid; dynamic range 0 SDR (default), 1 HDR; chroma 0 4:2:0 (default), 1 4:4:4; valid video packet size 200..=65471 (one stream packet in an IPv6 UDP datagram), below 200 refused; FEC default 20 %. The bitrate comment citing Sunshine is logged above and not used. | | S-31 | 2026-12-04 | Moonshine at `f184d5e`: `src/session/stream/mod.rs`, `src/session/stream/video/mod.rs`; the repository tree listing (GitHub API) | BSD-2, facts only. `bitStreamFormat` 0 H.264 (default), 1 HEVC, 2 AV1, others invalid; dynamic range 0 SDR (default), 1 HDR; chroma 0 4:2:0 (default), 1 4:4:4; valid video packet size 200..=65471 (one stream packet in an IPv6 UDP datagram), below 200 refused; FEC default 20 %. The bitrate comment citing Sunshine is logged above and not used. |
| S-32 | 2026-12-04 | [Wolf: RTSP](https://games-on-whales.github.io/wolf/stable/protocols/rtsp.html) again (as S-3); [RFC 2326](https://www.rfc-editor.org/rfc/rfc2326.txt) | Wolf: nothing new for the host (no per-method answers, no ANNOUNCE list). RFC 2326: reason phrases of 400, 451, 454, 455, 501 (7.1.1); a missing `Content-Length` means zero (4.4); OPTIONS may be sent at any time (10.1); session ids at least 8 random octets (3.4); `Public` as a comma-separated list (10.1 example). | | S-32 | 2026-12-04 | [Wolf: RTSP](https://games-on-whales.github.io/wolf/stable/protocols/rtsp.html) again (as S-3); [RFC 2326](https://www.rfc-editor.org/rfc/rfc2326.txt) | Wolf: nothing new for the host (no per-method answers, no ANNOUNCE list). RFC 2326: reason phrases of 400, 451, 454, 455, 501 (7.1.1); a missing `Content-Length` means zero (4.4); OPTIONS may be sent at any time (10.1); session ids at least 8 random octets (3.4); `Public` as a comma-separated list (10.1 example). |
| S-34 | 2026-12-04 | [Stock ENet](https://github.com/lsalzman/enet) v1.3.18 (`2662c0d`, same pin as S-17), read again for the host side: `protocol.c` (`enet_protocol_handle_connect`, `_verify_connect`, `_disconnect`, `_ping`, `_bandwidth_limit`, `_throttle_configure`, `_acknowledge`, `_send_unsequenced`, `_send_unreliable_fragment`, `_send_reliable`/`_send_fragment` state checks, the acknowledgement rules of `_handle_incoming_commands`, the ping condition of `_send_outgoing_commands`) and `include/enet/enet.h` (peer window constants) | MIT. Facts for PROTOCOL.md 3.1 "The accepting side" and `enet::host`: a CONNECT is answered by a reliable verify on channel 0xFF and is not itself acknowledged; repeated connects from a live peer are refused; session id derivation (offered id or the slot's, plus one mod 4, skipping the slot's previous id) and which verify field carries which; MTU, window and channel clamping, bandwidths are the host's own, throttle echoed, connect data reported with the connect event; connected on the acknowledgement of the verify; acknowledgements only while connected and only with a sent time, a failing command ends the datagram; ping, bandwidth and throttle need the connected state; unsequenced window 1024 groups, 32 free windows; pings when nothing was received for the ping interval and nothing reliable is in flight. Read through an automated summary of the raw files at the pinned commit; no code copied. | | S-34 | 2026-12-04 | [Stock ENet](https://github.com/lsalzman/enet) v1.3.18 (`2662c0d`, same pin as S-17), read again for the host side: `protocol.c` (`enet_protocol_handle_connect`, `_verify_connect`, `_disconnect`, `_ping`, `_bandwidth_limit`, `_throttle_configure`, `_acknowledge`, `_send_unsequenced`, `_send_unreliable_fragment`, `_send_reliable`/`_send_fragment` state checks, the acknowledgement rules of `_handle_incoming_commands`, the ping condition of `_send_outgoing_commands`) and `include/enet/enet.h` (peer window constants) | MIT. Facts for PROTOCOL.md 3.1 "The accepting side" and `enet::host`: a CONNECT is answered by a reliable verify on channel 0xFF and is not itself acknowledged; repeated connects from a live peer are refused; session id derivation (offered id or the slot's, plus one mod 4, skipping the slot's previous id) and which verify field carries which; MTU, window and channel clamping, bandwidths are the host's own, throttle echoed, connect data reported with the connect event; connected on the acknowledgement of the verify; acknowledgements only while connected and only with a sent time, a failing command ends the datagram; ping, bandwidth and throttle need the connected state; unsequenced window 1024 groups, 32 free windows; pings when nothing was received for the ping interval and nothing reliable is in flight. Read through an automated summary of the raw files at the pinned commit; no code copied. |
| S-26 | 2026-12-04 | [Moonshine](https://github.com/hgaiser/moonshine) at `f184d5e` (same pin as S-9): `src/session/stream/video/packetizer.rs` and `src/session/stream/video/mod.rs` again, read for the host after the L2 demo | BSD-2, facts only. The raised FEC percentage for a minimum parity count (`(minimum - 1) * 100 / k + 1`, capped by 255 and the 255-shard limit), parity rounded up; the even block split (RFC 5052 9.1); per-block data shards from `255 * 100 / (100 + percentage)`, at most 4 blocks; which parity header fields it patches; the 8-byte frame header and last-shard length; the encryption prefix order (IV, frame number, tag). A comment in `video/mod.rs`: a fresh Moonlight session expects frame numbers to start at 1 (a client behaviour, no Sunshine or moonlight-common-c value; to be confirmed by our measurement). No comment in these parts cites Sunshine or moonlight-common-c for a packetizer value. |
+13
View File
@@ -1,5 +1,18 @@
# DomiStream — handover # DomiStream — handover
## stream-v0.2.2 (2026-12-04)
After the L2 demo (Arena Domi Remote crashed at Lumen's first video frame): the video packetizer splits FEC blocks
evenly, larger blocks first (RFC 5052 9.1, as Moonshine's host does it), and a refused INPUT_DATA names its input
type for the logs (`ClientControlMessage::InputRejected::input_type`). The frame index starting at 1 is the caller's
(Lumen's) job; PROTOCOL.md 5.2 records it. Tests first; workspace 424 passed, 0 failed.
## stream-v0.2.1 (2026-12-04)
Patch for Lumen L2: the client's `ControlStream` sends `START_B`, `PERIODIC_PING` and the IDR request with empty
bodies (PROTOCOL.md 3.3; `START_A` stays refused, U10), so our own clients can start and keep a stream on Lumen
(PR #15, tests first). Workspace 422 passed, 0 failed; clippy, fmt and rustdoc clean.
## stream-v0.2.0 (2026-12-04) ## stream-v0.2.0 (2026-12-04)
The GameStream host side, sans-I/O, for Lumen (milestone L1, `docs/LUMEN-HOST-PLAN.md` 3.1), next to the client of The GameStream host side, sans-I/O, for Lumen (milestone L1, `docs/LUMEN-HOST-PLAN.md` 3.1), next to the client of
+35 -14
View File
@@ -23,13 +23,10 @@ ours on the host side is marked as such in the host notes:
| 5.2-5.3 Video | `video::packetizer` | 5.3, "Host side": FEC block split and parity | | 5.2-5.3 Video | `video::packetizer` | 5.3, "Host side": FEC block split and parity |
| 6.2-6.4 Audio | `audio::packetizer` | 6.4, last paragraph: no parity until U16 | | 6.2-6.4 Audio | `audio::packetizer` | 6.4, last paragraph: no parity until U16 |
Both halves are tested against each other in one in-memory session (`crates/domistream/tests/session.rs`). Found Both halves are tested against each other in one in-memory session (`crates/domistream/tests/session.rs`). The
there, still open: the client's `ControlStream` refuses to send `START_B`, `PERIODIC_PING` and the IDR request client's `ControlStream` sends `START_B`, `PERIODIC_PING` and the IDR request with empty bodies (lead's decision,
(bodies U10, 3.3). With `ControlStream` alone our client cannot start a stream on our host, and a host with a stop 2026-12-04, since stream-v0.2.1): what Moonshine and Lumen read (3.3). Whether Sunshine reads more is still U10;
deadline (60 s by default) would end the session; the session test sends the three with empty bodies over `START_A` stays refused. The host keeps the client's `updateState` (1.5, U1) for the logs without reading it.
`EnetClient` and `ControlCipher`, as `tools/gs-probe` does. The host keeps the client's `updateState` (1.5, U1) for the
logs without reading it. **Decided (lead, 2026-12-04):** `ControlStream` will send the three with empty bodies,
what Moonshine and Lumen read; it lands with the first streaming client of L2, and U10 stays open for Sunshine.
### Measured: Arena Domi Remote against lumen-host [L1] ### Measured: Arena Domi Remote against lumen-host [L1]
@@ -56,6 +53,27 @@ and the operator's notes:
The other clients (the Moonlight PC app, Arena Domi TV) are measured when they connect. The other clients (the Moonlight PC app, Arena Domi TV) are measured when they connect.
**L2 demo, the same client against lumen-host with streaming (2026-12-04) [L1]:** pairing again in about 4 s from
the typed code; box art from `/appasset` shown for all 11 games; `/launch` (1280x720x60, `surroundAudioInfo=196610`)
answered with `sessionUrl0=rtsp://127.0.0.1:49010`. Then, for this client:
- **RTSP (U5):** one TCP connection per request, and the client **reads until the host closes the connection**; a
host that keeps it open makes every request wait for a timeout (measured: about 10.5 s per request against
lumen-host before its fix; Arena PR #56 now closes after every answer). Requests: OPTIONS (target
`rtsp://0.0.0.0:49010`; headers `CSeq`, `X-GS-ClientVersion: 14`, `Host`), DESCRIBE (adds `Accept`,
`If-Modified-Since`), SETUP `streamid=audio/0/0`, `streamid=video/0/0`, `streamid=control/13/0` (adds `Transport`;
`Session` from the second SETUP on), ANNOUNCE (on `streamid=control/13/0`, 1491 bytes), PLAY.
- **ANNOUNCE (U6):** 37 attributes, among them `x-nv-vqos[0].bitStreamFormat` = HEVC, viewport 1280x720, `maxFPS`
60, `packetSize` 1360, `configuredBitrateKbps` 10000, `x-ss-general.encryptionEnabled` 7, `minRequiredFecPackets`
2, `maxNumReferenceFrames` 1, `dynamicRangeMode` 0, `encoderCscMode` 2, stereo (`surround.enable` 0, 2 channels,
mask 3), `x-nv-aqos.packetDuration` 5; no `refPicInvalidation` line. Also sent: `x-ml-general.featureFlags`,
`x-nv-video[0].rateControlMode`, `timeoutLengthMs`, `framesWithInvalidRefThreshold`, `initialBitrateKbps`,
`initialPeakBitrateKbps`, `x-nv-vqos[0].bw.minimumBitrateKbps`/`maximumBitrateKbps`, `fec.enable`,
`videoQualityScoreUpdateTime`, `x-nv-general.featureFlags`, `useReliableUdp`, `bllFec.enable`, `drc.enable`,
`enableRecoveryMode`, `videoEncoderSlicesPerFrame`, `x-nv-clientSupportHevc`, `clientRefreshRateX100`.
- The client's own error text, when the RTSP handshake failed, named the GameStream default ports (TCP 48010, UDP
48000, 48010), not the ports it was using: it is a fixed text, not a statement of what it connected to.
- `/cancel` answered 200 with the ok root brings the client back to its game list without an error.
**Tags** (details in the source log, [CLEAN_ROOM.md](CLEAN_ROOM.md)): **Tags** (details in the source log, [CLEAN_ROOM.md](CLEAN_ROOM.md)):
| Tag | Source | | Tag | Source |
@@ -595,7 +613,7 @@ Each packet is `packetSize + 16` bytes, `packetSize` from ANNOUNCE (default 1024
| 8 | 4 | SSRC, 0 [M] | | 8 | 4 | SSRC, 0 [M] |
| 12 | 4 | reserved [W5] | | 12 | 4 | reserved [W5] |
| 16 | 4 | stream packet index, LE (= RTP sequence << 8 [M]) | | 16 | 4 | stream packet index, LE (= RTP sequence << 8 [M]) |
| 20 | 4 | frame index, LE [W5][M] | | 20 | 4 | frame index, LE [W5][M]; **starts at 1** in a fresh session (Moonshine's note on what Moonlight-family clients expect [M], S-26; a host that started at 0 crashed Arena Domi Remote at its first frame, L2 demo) |
| 24 | 1 | flags: 0x01 picture data, 0x02 end of frame, 0x04 start of frame [W5] | | 24 | 1 | flags: 0x01 picture data, 0x02 end of frame, 0x04 start of frame [W5] |
| 25 | 1 | reserved [W5] | | 25 | 1 | reserved [W5] |
| 26 | 1 | multi-FEC flags, `0x10` [M] (UNKNOWN U15: meaning) | | 26 | 1 | multi-FEC flags, `0x10` [M] (UNKNOWN U15: meaning) |
@@ -632,12 +650,15 @@ Reed-Solomon erasure code over GF(2^8), polynomial `0x11D` [F] [W5]:
`P = [[8e f4 47 a7], [f4 8e a7 47]]`; `k = 3, m = 1`: `P = [[01 8e f4]]`. `P = [[8e f4 47 a7], [f4 8e a7 47]]`; `k = 3, m = 1`: `P = [[01 8e f4]]`.
The capture settles it without any loss: parity packets are always sent, so our encoder must reproduce the The capture settles it without any loss: parity packets are always sent, so our encoder must reproduce the
captured parity bytes (offset 32 on) of every block. captured parity bytes (offset 32 on) of every block.
- **Host side (Lumen, `video::packetizer`).** Our own choices, not from a source, until a capture compares them - **Host side (Lumen, `video::packetizer`).** The fewest blocks (at most 4) in which every block can carry the
with a real host: the fewest blocks (at most 4) in which every block can carry the requested parity within requested parity within `k + m <= 255`, split **evenly**: sizes differ by at most one, the larger blocks first
`k + m <= 255`, every block but the last carrying `k = ceil(n / blocks)` data shards; per block the least (RFC 5052 9.1, as Moonshine's host does it [M], S-26); per block the least percentage, at or above the requested
percentage, at or above the requested one, whose `m` reaches `minRequiredFecPackets`; a frame too big for that one, whose `m` reaches `minRequiredFecPackets`; Moonshine computes the same raised percentage
gets the most parity that still fits (counted in the packetizer's stats). Data shards in order, then the block's (`(minimum - 1) * 100 / k + 1`, e.g. 101 % for 1 shard, 51 % for 2, 34 % for 3 with a minimum of 2) [M]; a frame
parity, block by block; RTP sequence numbers run on across frames, one per packet. too big for that gets the most parity that still fits (counted in the packetizer's stats). Data shards in order,
then the block's parity, block by block; RTP sequence numbers run on across frames, one per packet. A capture of a
real host still has to confirm the parity header fields: Moonshine patches only the RTP sequence, frame index,
multi-FEC blocks byte and FEC info of a parity packet [M]; we write all header fields.
- The audio code is **not** this matrix (section 6.4). - The audio code is **not** this matrix (section 6.4).
### 5.4 Feedback ### 5.4 Feedback
+1 -1
View File
@@ -236,7 +236,7 @@ dependencies = [
[[package]] [[package]]
name = "domistream" name = "domistream"
version = "0.2.0" version = "0.2.2"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",
+1 -1
View File
@@ -228,7 +228,7 @@ dependencies = [
[[package]] [[package]]
name = "domistream" name = "domistream"
version = "0.2.0" version = "0.2.2"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",