Compare commits

...

5 Commits

9 changed files with 46 additions and 28 deletions
Generated
+1 -1
View File
@@ -241,7 +241,7 @@ dependencies = [
[[package]] [[package]]
name = "domistream" name = "domistream"
version = "0.2.0" version = "0.2.1"
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.1"
edition = "2024" edition = "2024"
rust-version = "1.89" rust-version = "1.89"
license = "CPAL-1.0" license = "CPAL-1.0"
+18 -11
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
}
+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! {
+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 {
+6
View File
@@ -1,5 +1,11 @@
# DomiStream — handover # 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) ## 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
+4 -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 | | 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]
+1 -1
View File
@@ -236,7 +236,7 @@ dependencies = [
[[package]] [[package]]
name = "domistream" name = "domistream"
version = "0.2.0" version = "0.2.1"
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.1"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",