[domistream] Host: even FEC split, input type diagnostics, 0.2.2 #18
Generated
+1
-1
@@ -241,7 +241,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "domistream"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"aes-gcm",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ exclude = ["fuzz"]
|
||||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
edition = "2024"
|
||||
rust-version = "1.89"
|
||||
license = "CPAL-1.0"
|
||||
|
||||
@@ -63,6 +63,9 @@ pub enum ClientControlMessage {
|
||||
InputRejected {
|
||||
/// Body length.
|
||||
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.
|
||||
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::InputData as u16 => match crate::input::parse_input(message) {
|
||||
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() },
|
||||
})
|
||||
|
||||
@@ -183,14 +183,14 @@ pub fn plan_fec_blocks(data_shards: usize, fec_percentage: u8, min_parity: u8) -
|
||||
let blocks = (1..=MAX_FEC_BLOCKS)
|
||||
.find(|&b| wished_percentage(data_shards.div_ceil(b), fec_percentage, min_parity).is_some())
|
||||
.unwrap_or(MAX_FEC_BLOCKS);
|
||||
let k_full = data_shards.div_ceil(blocks);
|
||||
let count = data_shards.div_ceil(k_full);
|
||||
let mut plan = Vec::with_capacity(count);
|
||||
let mut left = data_shards;
|
||||
while left > 0 {
|
||||
let k = left.min(k_full);
|
||||
// Even split (RFC 5052 9.1, as a BSD-2 host does it; PROTOCOL.md 5.3): the first `r` blocks carry one shard
|
||||
// more, so block sizes differ by at most one and the largest is `ceil(n / blocks)`, the size checked above.
|
||||
let blocks = blocks.min(data_shards);
|
||||
let (q, r) = (data_shards / blocks, data_shards % blocks);
|
||||
let mut plan = Vec::with_capacity(blocks);
|
||||
for i in 0..blocks {
|
||||
let k = if i < r { q + 1 } else { q };
|
||||
plan.push(block(k, fec_percentage, min_parity)?);
|
||||
left -= k;
|
||||
}
|
||||
Ok(plan)
|
||||
}
|
||||
|
||||
@@ -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-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-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. |
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# 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
|
||||
|
||||
+10
-7
@@ -613,7 +613,7 @@ Each packet is `packetSize + 16` bytes, `packetSize` from ANNOUNCE (default 1024
|
||||
| 8 | 4 | SSRC, 0 [M] |
|
||||
| 12 | 4 | reserved [W5] |
|
||||
| 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] |
|
||||
| 25 | 1 | reserved [W5] |
|
||||
| 26 | 1 | multi-FEC flags, `0x10` [M] (UNKNOWN U15: meaning) |
|
||||
@@ -650,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]]`.
|
||||
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.
|
||||
- **Host side (Lumen, `video::packetizer`).** Our own choices, not from a source, until a capture compares them
|
||||
with a real host: the fewest blocks (at most 4) in which every block can carry the requested parity within
|
||||
`k + m <= 255`, every block but the last carrying `k = ceil(n / blocks)` data shards; per block the least
|
||||
percentage, at or above the requested one, whose `m` reaches `minRequiredFecPackets`; a frame 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.
|
||||
- **Host side (Lumen, `video::packetizer`).** The fewest blocks (at most 4) in which every block can carry the
|
||||
requested parity within `k + m <= 255`, split **evenly**: sizes differ by at most one, the larger blocks first
|
||||
(RFC 5052 9.1, as Moonshine's host does it [M], S-26); per block the least percentage, at or above the requested
|
||||
one, whose `m` reaches `minRequiredFecPackets`; Moonshine computes the same raised percentage
|
||||
(`(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
|
||||
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).
|
||||
|
||||
### 5.4 Feedback
|
||||
|
||||
Generated
+1
-1
@@ -236,7 +236,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "domistream"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"aes-gcm",
|
||||
|
||||
Generated
+1
-1
@@ -228,7 +228,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "domistream"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"aes-gcm",
|
||||
|
||||
Reference in New Issue
Block a user