[domistream] Control: START_B, PERIODIC_PING and the IDR request with empty bodies (PROTOCOL.md 3.3); START_A stays refused

This commit is contained in:
2026-12-04 13:46:12 +01:00
parent 66679229db
commit 4300b6b7fb
2 changed files with 22 additions and 18 deletions
+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
}
+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]