Compare commits

..

7 Commits

9 changed files with 67 additions and 28 deletions
Generated
+1 -1
View File
@@ -241,7 +241,7 @@ dependencies = [
[[package]]
name = "domistream"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"aes",
"aes-gcm",
+1 -1
View File
@@ -5,7 +5,7 @@ exclude = ["fuzz"]
resolver = "3"
[workspace.package]
version = "0.2.0"
version = "0.2.1"
edition = "2024"
rust-version = "1.89"
license = "CPAL-1.0"
+18 -11
View File
@@ -269,11 +269,11 @@ pub fn parse_host_message(message: &[u8]) -> Result<HostMessage> {
pub enum ClientMessage {
/// `START_A` (body UNKNOWN U10).
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,
/// Keep-alive (body UNKNOWN U10).
/// Keep-alive, sent with an empty body (3.3).
PeriodicPing,
/// Ask for an IDR frame (body UNKNOWN U10).
/// Ask for an IDR frame, sent with an empty body (3.3).
RequestIdrFrame,
/// Ask the host to stop referencing frames `first..=last`.
InvalidateRefFrames {
@@ -289,8 +289,9 @@ pub enum ClientMessage {
/// Serializes a message to the host (type, length, body), ready for [`super::ControlCipher::seal`].
///
/// # Errors
/// [`crate::Error::Unsupported`] for a message whose body is still UNKNOWN (U10: START_A, START_B,
/// PERIODIC_PING, IDR request; refused rather than guessed); input errors as [`crate::input::encode_input`].
/// [`crate::Error::Unsupported`] for START_A, whose body is still UNKNOWN (U10; refused rather than guessed);
/// 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>> {
match message {
ClientMessage::InvalidateRefFrames { first, last } => {
@@ -304,11 +305,17 @@ pub fn encode_client_message(message: &ClientMessage) -> Result<Vec<u8>> {
Ok(m)
}
ClientMessage::Input(e) => crate::input::encode_input(e),
ClientMessage::StartA
| ClientMessage::StartB
| ClientMessage::PeriodicPing
| ClientMessage::RequestIdrFrame => {
Err(crate::Error::Unsupported { what: "a control message whose body is still UNKNOWN (U10)" })
}
ClientMessage::StartB => Ok(empty_body(MessageType::StartB)),
ClientMessage::PeriodicPing => Ok(empty_body(MessageType::PeriodicPing)),
ClientMessage::RequestIdrFrame => Ok(empty_body(MessageType::IdrFrame)),
ClientMessage::StartA => Err(crate::Error::Unsupported { what: "START_A, 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
}
+11 -4
View File
@@ -381,11 +381,18 @@ fn client_messages() {
encode_client_message(&ClientMessage::Input(ev.clone())).unwrap(),
domistream::input::encode_input(&ev).unwrap()
);
// Bodies still UNKNOWN (U10) are refused rather than guessed.
for m in [ClientMessage::StartA, ClientMessage::StartB, ClientMessage::PeriodicPing, ClientMessage::RequestIdrFrame]
{
assert_err!(encode_client_message(&m), Error::Unsupported { .. }, "{m:?}");
// START_B, PERIODIC_PING and the IDR request go with an empty body (PROTOCOL.md 3.3: what Moonshine and Lumen
// read; the lead's decision of 2026-12-04). START_A's body is still UNKNOWN (U10) and stays refused.
for (m, t) in [
(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! {
+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)
);
// ENet connect on the control port, then START_B. ControlStream refuses START_B (body U10), hence the probe path.
assert_err!(encode_client_message(&ClientMessage::StartB), Error::Unsupported { .. });
// ENet connect on the control port, then START_B. ControlStream sends START_B with an empty body (3.3); the
// 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 {
config: ControlHostConfig {
enet: EnetHostConfig {
+6
View File
@@ -1,5 +1,11 @@
# DomiStream — handover
## 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)
The GameStream host side, sans-I/O, for Lumen (milestone L1, `docs/LUMEN-HOST-PLAN.md` 3.1), next to the client of
+25 -7
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 |
| 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
there, still open: the client's `ControlStream` refuses to send `START_B`, `PERIODIC_PING` and the IDR request
(bodies U10, 3.3). With `ControlStream` alone our client cannot start a stream on our host, and a host with a stop
deadline (60 s by default) would end the session; the session test sends the three with empty bodies over
`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.
Both halves are tested against each other in one in-memory session (`crates/domistream/tests/session.rs`). The
client's `ControlStream` sends `START_B`, `PERIODIC_PING` and the IDR request with empty bodies (lead's decision,
2026-12-04, since stream-v0.2.1): what Moonshine and Lumen read (3.3). Whether Sunshine reads more is still U10;
`START_A` stays refused. The host keeps the client's `updateState` (1.5, U1) for the logs without reading it.
### 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.
**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)):
| Tag | Source |
+1 -1
View File
@@ -236,7 +236,7 @@ dependencies = [
[[package]]
name = "domistream"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"aes",
"aes-gcm",
+1 -1
View File
@@ -228,7 +228,7 @@ dependencies = [
[[package]]
name = "domistream"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"aes",
"aes-gcm",