Internet-Draft MLP December 2026
Kuzyaev Expires 4 June 2027 [Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-kuzyaev-medialane-01
Published:
Intended Status:
Informational
Expires:
Author:
V. Kuzyaev
Independent

Media Lane Protocol (MLP) Version 1

Abstract

The Media Lane Protocol (MLP) is an application-layer transport for real-time interactive media over links that are slow, lossy, or both. MLP carries three kinds of traffic -- control, media, and feedback -- and keeps them isolated. A sender emits opaque, self-describing media updates, paces them under a capacity it measures, and tracks which updates each receiver has applied. A receiver applies an update atomically or not at all and acknowledges the window of updates it holds. MLP specifies a compact binary framing, a session handshake, parking and resumption, an input path with deadline and duplicate suppression, forward error correction, and a timeout framework derived from the measured round-trip time. It does not define media encoding, session authentication, or a signaling protocol; it runs inside an authenticated, confidential carrier such as TLS, WebSocket, QUIC, or WebRTC data channels. This document defines version 1 of MLP.

Discussion

This document is an individual Internet-Draft. It has no working group affiliation. Comments and implementation reports are welcome and should be sent to the author.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 4 June 2027.

▲

Table of Contents

1. Introduction

1.1. Problem Statement

Interactive media -- remote desktop, cloud gaming, live collaboration, and remote support -- fails differently from streaming media. A streaming player can buffer seconds of content and hide a lossy link behind that buffer. An interactive session cannot: the user's input must be reflected quickly, the picture must converge after motion stops, and a short outage must not end the session. Existing transports address parts of this problem, but each couples the application to a particular stack, a particular carrier, or a particular media format.

MLP is a small, self-contained transport for this class of application. It carries content it does not interpret, isolates the traffic that keeps a session alive from the traffic that fills the link, measures the link instead of assuming it, and defines exactly what a receiver holds and what a sender may assume about it.

1.2. Design Goals

  1. Atomic delivery. A receiver applies an update whole or not at all. A partial update is never presented.

  2. Bounded state. Every queue, table, and decoding buffer has a stated bound. No peer can make another peer allocate without limit.

  3. Honest accounting. A sender knows which updates each receiver has applied, and a receiver's convergence is a predicate over that set rather than an impression.

  4. Measured pacing. The sender paces under a capacity it measures with its own probes, subject to the carrier's congestion control, rather than under a rate it assumes.

  5. Content neutrality. The protocol moves opaque bytes. It does not parse a codec's payload, and a new codec requires no change to the transport.

  6. Carrier independence. The same fragment grammar runs over a reliable, ordered stream and over an unreliable, unordered datagram carrier.

  7. Sans-IO. The protocol machines take time as a parameter and return outbound bytes as values. They do not read a clock, open a socket, or own a runtime.

1.3. Non-Goals

MLP deliberately does not define:

  • the meaning, encoding, or quality of media content, which is a codec's concern;

  • user authentication, authorization, or identity; a session exists only inside a carrier that has already authenticated it;

  • encryption or integrity protection; the carrier provides both;

  • signaling, session discovery, or NAT traversal, except for the datagram-carrier exchange carried inside an established session;

  • a deployment's topology, endpoints, supervision, or persistence;

  • audio, which is not carried by this version;

  • multipath delivery, stream multiplexing, and 0-RTT resumption, which are not part of version 1.

1.4. Relationship to Other Protocols

MLP is complementary to, not a replacement for, the protocols below it and beside it.

QUIC and TCP:

MLP can run over a QUIC stream or a TCP-based stream such as WebSocket. The carrier owns reliability, ordering, and congestion control; MLP adds media framing, delivery accounting, and application-level pacing within the rate the carrier sustains.

WebRTC data channels:

MLP can use WebRTC data channels as an unreliable datagram carrier. The WebRTC stack owns ICE, DTLS, SCTP, and its congestion control; MLP adds the media semantics and its own measurement of the rate the carrier delivers.

RTP and WebRTC media:

RTP is a media packet format with its own timing, loss repair, and codec negotiation model. MLP does not carry RTP semantics; it carries whole application updates and leaves timing and content to the codec.

Protobuf:

The class bodies are encoded with a restricted Protocol Buffers wire format. The framing, the TLVs, and the media payload are not protobuf.

1.5. Document Organization

Section 2 fixes the terminology and notation. Section 3 states the architecture, the traffic classes, and the isolation rules. Section 4 defines the carrier bindings. Section 5 is the wire format. Section 6 defines the class bodies. Section 7 defines the session lifecycle. Section 8 defines delivery, capacity estimation, pacing, and forward error correction. Section 9 defines the input path. Section 10 fixes the timeout framework. Section 11 covers security and privacy. Section 12 covers IANA. The appendices carry test vectors, the body schema, the state machines, the design rationale, and implementation status.

2. Conventions and Terminology

2.1. Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

2.2. Terminology

Session:

The association between one sender and one receiver, identified by a media session identifier. A session survives a carrier failure by parking and resuming.

Lane:

An independent path for objects between two peers. A session has a control lane and a media lane. The lanes MAY be carried over separate connections or share one; their traffic classes remain distinct.

Sender:

The peer that produces media updates and accounts for what each receiver holds.

Receiver:

The peer that applies updates and acknowledges them.

Intermediary:

A peer that forwards whole objects between a sender and a receiver without interpreting their content.

Carrier:

The transport over which fragments travel. A stream carrier is reliable and ordered. A datagram carrier may lose, duplicate, and reorder.

Fragment:

The unit of MLP framing: a fixed header, an optional header extension, and a class-specific body.

Object:

A unit of framing consisting of one or more fragments. An object is reassembled before it is delivered.

Update:

The protocol's unit of media state. An update consists of one or more parts; each part is carried as one object.

Part:

One contiguous piece of an update, carried as exactly one object. A single-part update is one object.

Cell:

One element of the sender's coverage grid. A cell is an accounting label, not a unit of content: the content layer decides what a cell contains.

Chain epoch:

A sender-owned counter that advances when the sender breaks the update chain. A receiver adopts a greater epoch and never a smaller one.

Convergence:

The state in which a receiver's pending set is empty and the last update it applied is the last update the sender emitted.

Parking:

The deliberate retention of a session's state after its carrier fails, so that a returning peer can resume it.

Sans-IO:

A design in which the protocol machines neither perform I/O nor read a clock; time and bytes cross the boundary as parameters and return values.

2.3. Byte Order and Notation

All multi-byte integers on the wire are little-endian. Offsets are zero-based from the first byte of the fragment. The notation u8, u16, u32, u64, i32, and f64 denotes an unsigned 8-, 16-, 32-, or 64-bit integer, a signed 32-bit integer, and an IEEE 754 double-precision value, respectively. A bit field is numbered from bit 0, the least significant bit. Hexadecimal bytes are written as two lowercase digits, for example 4d 4c 50 00.

An RTT is the sender's smoothed round-trip time in milliseconds; RTT_min is the minimum over the estimator's sliding horizon; J is the jitter estimate. A formula such as clamp(4 x RTT_min, 250 ms, 2 s) means the value is clamped to the closed interval.

2.4. Session-Relative Time

MLP never requires synchronized clocks. Every timestamp is an unsigned 64-bit count of milliseconds since the sender's session started, or, where stated, since the reporting peer's session started. Timestamps are compared only within the clock that produced them. A sender measures a round trip by quoting its own timestamp in a probe and reading that timestamp back in the echo; it never subtracts a peer's clock from its own. A value of zero in a deadline field means "no deadline".

2.5. Roles

The three roles are named by what they do, not by where they are deployed. One process may perform more than one role.

Table 1: Protocol roles
Role Does Never
Sender Produces updates, measures the link, paces output, and accounts for each receiver's applied window. Interprets a receiver's content.
Receiver Applies updates atomically, acknowledges what it applied, and reports the link it measures. Decides what the sender should send next.
Intermediary Forwards whole objects, preserves unknown header extensions, and reports what it dropped. Decodes or rewrites an object's content.

3. Architecture

3.1. Lanes and Traffic Classes

A session carries five traffic classes. The class a fragment belongs to is fixed by the header's class field, except that control-lane classes share the CONTROL class and are distinguished by their body.

Table 2: Traffic classes
Class Name Objects Semantics Priority
C0 Control and lifecycle Handshake, resume, lane state, errors, close Reliable, ordered, urgent 0
C1 Input Pointer, key, wheel, clipboard, pressed set Reliable, ordered, deadline-bounded, deduplicated 1
C2 Cursor Pointer position and shape Unreliable, latest-wins, never retransmitted 5
C3 Media Media updates; parity objects Atomic objects, repair by a later whole state 6 interactive, 7 background
C4 Feedback Acknowledgements, reports, hop reports, probe echoes Acknowledgements are priority 0; reports priority 2 0 or 2

Input and session control stay on the control lane, where ordering matters and volume does not. Media, cursor, and feedback travel on the media lane. When the media lane is unavailable, feedback MAY travel on the control lane; the reverse is not permitted for media bulk.

3.2. Isolation Rules

The following rules are normative. They exist so that a stalled acknowledgement cannot delay a control message and a large media object cannot delay either.

  1. Logical separation. A session has a control lane and a media lane. A deployment SHOULD carry them over separate connections. When it carries them over one connection, every rule below except head-of-line isolation still applies, and the deployment MUST report that the session is in single-connection mode through its own operational interface.

  2. Strict priority. A writer drains objects in this order: C0, C1, C2, C4 (acknowledgements and reports), C3 priority 6, C3 priority 7. The header's priority field is the single authority. A class that is not droppable -- C0, C1, and C4 -- MUST have a queue sized for its own window, so a full media queue never costs a report.

  3. Reserved rate. The media pacer reserves max(2 kbps, 10% x pace) for non-media traffic. A media object MUST NOT be released if doing so would leave less than max(1 x RTT, 250 ms) of that reserve. Non-media classes MAY borrow media tokens; media MUST NOT borrow the reserve.

  4. Bounded in-flight. A sender starts with at most two media objects awaiting the carrier per receiver and earns up to its configured in_flight_cap after three consecutive report intervals in which the link was both healthy (attributed loss below 1%) and actually exercised (at least 8192 bytes sent in the window). Any other window revokes the earned depth. A sender MUST NOT hand a carrier more than in_flight_cap x max_object_bytes beyond what the carrier has accepted.

  5. Whole-object coalescing. A coalescing slot holds whole objects, never parts of two. An anchor object and an echo-critical object are never replaced by a chained or ordinary object. A replaced object's cells remain pending; the next whole state covers them.

  6. Input is never coalesced for capacity. A hop MUST NOT drop an input object because a queue is full; it MAY coalesce pointer moves and wheel deltas as Section 9 describes.

3.3. Protocol Layers and the Sans-IO Boundary

An implementation is a set of deterministic state machines. Time enters as an Instant parameter; outbound data leaves as Action values; randomness, where needed, is supplied by the driver. The machines do not read a clock, open a socket, or own a thread. This boundary is not a wire requirement, but it is the reason the protocol can be replayed deterministically and tested against a modelled link.

Three loops run inside a sender:

  • the content loop, which turns a change in the content into one or more updates;

  • the delivery loop, which tracks what each receiver has applied and what it may be missing;

  • the capacity loop, which measures the link and sets the pace and the per-update budget.

3.4. Protocol State

A sender keeps, per receiver: the next update identifier, the last update the receiver confirmed, the 64-update acknowledgement window, the chain epoch, the pending cell set with the update that last wrote each cell, the pacer state, the estimator state, the input pressed set, and the resume state when the session is parked.

A receiver keeps: the highest applied update identifier, the 64-update acknowledgement bitmap, the chain epoch it has adopted, the open-object table, the applied-update deduplication window, the input queue, the pressed set, and its own measurement window.

A hop keeps: the open-object table, the per-class queues, the coalescing slot, the forwarding counters, and, when it reports, its own measurement window. A hop does not keep per-receiver media state.

3.5. Carrier Abstraction

MLP defines two carrier classes and does not require a particular transport protocol.

Stream carrier:

Reliable and ordered. One transport message contains one to N concatenated fragments. The fragment header is self-delimiting, so a receiver splits a coalesced message on fragment boundaries. WebSocket, QUIC streams, and gRPC are stream carriers.

Datagram carrier:

May lose, duplicate, and reorder. One transport message contains exactly one fragment, and that fragment's fragment_count MUST be 1. WebRTC data channels are the datagram carrier defined by this document.

The fragment byte layout is identical on both. Only the message boundary and the reliability assumptions differ.

4. Carriers

4.1. Carrier Requirements

A carrier used by MLP MUST provide:

  • message boundaries, so that one transport message carries a whole fragment or a whole run of concatenated fragments;

  • integrity and confidentiality, either in the carrier itself or in a layer below it, so that an on-path attacker cannot modify a fragment without detection;

  • a stated maximum message size and a stated reliability model.

A carrier that cannot provide integrity and confidentiality MUST NOT carry an MLP session. Section 11 states the consequences.

Table 3: Carrier classes and payload caps
Carrier Class Fragments per message Fragment payload cap Defined in
WebSocket Stream Exactly 1 65536 bytes Section 4.2
QUIC stream Stream 1 to N, concatenated 65536 bytes Section 4.3
gRPC message Stream 1 to N, concatenated 65536 bytes Section 4.4
WebRTC data channel Datagram Exactly 1 1150 bytes Section 4.5

The payload cap applies to the fragment's body only; the fixed header and the header extension are additional. A carrier's message limit MUST therefore be at least 22 + 256 + payload_cap bytes for a single maximum-size fragment. A receiver MUST reject a fragment whose payload_len exceeds its carrier's payload cap with BAD_LENGTH, and MUST reject a datagram-carrier message that carries more than one fragment or a fragment whose fragment_count is not 1 with BAD_FRAGMENT.

On a stream carrier a message MAY contain several fragments of the same or different objects. A receiver MUST split the message on the self-delimiting fragment headers. A message that ends inside a fragment, or whose final bytes are not exactly a fragment boundary, is rejected as a whole with BAD_LENGTH; the receiver does not deliver the fragments that preceded the error.

4.2. WebSocket

A media lane over WebSocket uses the WebSocket subprotocol name mlp-v1 [RFC6455]. The connection MUST be secured with TLS (a wss URI). One WebSocket binary message carries exactly one fragment.

A deployment SHOULD use two WebSocket connections per session: one for the control lane and one for the media lane. The media connection is established with the same credentials as the control connection and is bound to the same session by the media session identifier carried in MediaHello.

The following WebSocket close codes are used when the lane cannot continue. They are application close codes in the range reserved for the protocol; a deployment MUST NOT reuse them for another purpose.

Table 4: WebSocket close codes
Code Meaning
1000 Normal closure.
4400 The message did not parse as a valid fragment.
4401 The carrier has not authenticated the peer.
4403 The peer is authenticated but not authorized for this session.
4404 No such session, or the session has ended.
4409 Another connection already owns the session.
4410 The park TTL expired; the session cannot be resumed.
4413 An object exceeded the negotiated limit.
4415 The peer does not speak this media protocol version.

A close code ends the carrier, not necessarily the session. A receiver that holds a resume token reconnects according to Section 7.6; a close with code 4410 is terminal for that session.

4.3. QUIC Streams

A media lane over QUIC uses ALPN mlp-v1 [RFC9000] [RFC9001]. One bidirectional QUIC stream carries one media lane. The stream carries one to N concatenated fragments, exactly as the gRPC carrier does; a receiver splits them on their self-delimiting headers. The QUIC stream is a stream carrier: it preserves order and is reliable, so a deployment MUST NOT use QUIC DATAGRAM for media in this version.

The deployment owns the endpoint's certificate, private key, trust roots, and transport parameters. It MUST terminate TLS before MLP sees a stream, and it MUST set the QUIC idle timeout so that the session survives the deployment's outage target. As a starting point, an idle timeout of at least 70 s and a keep-alive interval of at most 10 s satisfy the arithmetic of Section 10 for a 30-second outage at a 2-second round trip.

A stream reset, a connection close, or an idle timeout ends the lane exactly as a WebSocket close does. The resume token and the chain rules of Section 7 are unchanged.

4.4. gRPC Messages

A media lane over gRPC carries one to N concatenated fragments in one gRPC message. The service definition, the method name, and the message envelope are deployment-defined and are outside this document. A deployment that uses gRPC MUST run it over TLS and MUST preserve message boundaries; a gRPC implementation that splits or merges MLP messages is not a conforming carrier.

The gRPC binding exists for deployments that already operate a gRPC control plane. It has no protocol behaviour beyond the stream carrier rules of Section 4.1.

4.5. WebRTC Data Channels

The datagram carrier is a pair of WebRTC data channels, mlp.media and mlp.repair, negotiated with SCTP over DTLS over ICE [RFC8831] [RFC8832]. Both channels are configured unreliable and unordered. One SCTP message carries exactly one fragment, and the fragment payload cap is 1150 bytes, which keeps a fragment inside a typical path MTU after the SCTP, DTLS, UDP, and IP headers.

The stream carrier remains open while the data channels are established, so a demotion is a local decision and requires no new handshake. The update chain, the chain epoch, the object-id space, the acknowledgement window, and the input sequence continue across a carrier switch.

4.5.1. Establishing the Datagram Carrier

The sender is the offerer. It creates the peer connection and both data channels, then sends a MediaDatagramSignal with an offer over the control lane. The receiver answers with an answer body; each side trickles its ICE candidates as candidate bodies over the same control lane. A close body retires the negotiation. A peer that cannot carry the datagram carrier ignores the offer, and the session stays on the stream carrier.

The exchange is authenticated by the control lane's carrier, and the WebRTC security architecture [RFC8827] applies to it. MLP does not define a second authentication or a second handshake. A peer that can carry the datagram carrier lists datagram in its MediaHello or MediaHelloAck capabilities. A data-channel close, an ICE failure, or a DTLS failure demotes the session at once, and the stream carrier resumes the media.

4.6. Carrier Selection

A receiver MAY be served over a datagram carrier when one is available. Promotion to the datagram carrier requires all of:

  • the carrier's connection is established;

  • the media channel is open;

  • a probe window of 2 x RTT_min has passed with a delivered ratio of at least 0.5.

Promotion happens when the datagram carrier's goodput is at least 1.2 times the stream carrier's, sustained for 3 x RTT_min. Demotion happens when the datagram carrier's goodput falls below 0.8 times the stream carrier's for 3 x RTT_min, when the channel closes, or when a probe window shows a delivered ratio below 0.2.

A switch costs one round trip. Both carriers stay open during the switch, the lane announces MediaPathChange, and the update chain continues. A switch MUST NOT happen during an input pulse. After three demotions within ten minutes, the datagram carrier is disabled for the session; the oscillation is counted.

4.7. Relationship to Carrier Congestion Control

MLP's capacity estimator and pacer are an application-layer adaptation layer. The congestion-control principles of [RFC2914] and the UDP guidance of [RFC8085] apply; a datagram deployment that uses QUIC's loss detection and congestion control follows [RFC9002]. They do not replace the carrier's congestion controller, and they MUST NOT be used to sustain a rate above what the carrier permits.

  • A deployment MUST run MLP over a carrier that performs congestion control (TCP, QUIC, or WebRTC's SCTP/GCC), or it MUST provision a hard rate ceiling for the session. A deployment that does neither MUST NOT use MLP on a shared network.

  • When the carrier exposes a maximum send rate or a congestion signal, MLP MUST clamp its pace to that rate. A stream-carrier reset, a blocked write, or a datagram carrier's loss signal MUST reduce the pace; MLP's own probe MUST NOT override it.

  • The one-second window allowance of 1.25 times the pace is a burst allowance, not a sustained rate. The long-run average MUST NOT exceed the pace.

  • A probe is a measurement, not a bypass of the carrier's congestion control. An implementation MUST send at most one probe per probe interval, MUST bound it to one fragment, and MUST NOT use the probe mechanism to carry content.

  • On a stream carrier, transport-level loss is not visible to MLP and MUST NOT be inferred from an update-id gap. The estimator's inputs on a stream carrier are the receiver's goodput, the sender's probe echoes, and the hop reports; an update-id gap is a delivery fact, not a link-loss measurement.

5. Wire Format

This section is the byte-level grammar. A fragment is the unit of framing; an object is a fragment set; an update is the unit of media state and consists of one or more parts, each carried as one object.

5.2. Flags

Bit 7 of the flags byte is reserved and MUST be zero. A fragment with bit 7 set is rejected with BAD_FLAGS.

Table 6: Fragment flags
Bit Name Description
0 FIN The last fragment of the object.
1 ANCHOR The content is absolute and may be applied onto any held state.
2 RETRANSMIT The sender's own resend.
3 DUP A deliberate duplicate of an echo-critical object.
4 ECHO_REQUESTED The receiver must reply with ECHO_OF_OBJECT_ID and timestamps.
5 PROBE A probe object.
6 URGENT Control drains before queued media.

FIN marks the last fragment of an object. A receiver MUST NOT deliver an object until it has seen FIN and every fragment index from zero through fragment_count - 1.

ANCHOR marks an update whose content is absolute: a receiver MAY apply it onto any state it holds. RETRANSMIT marks a resend by the sender's own policy. DUP marks a deliberate duplicate of an echo-critical object; a receiver that has already applied the object named by ECHO_OF_OBJECT_ID MUST NOT apply it twice. ECHO_REQUESTED obliges the receiver to answer with an echo that names the object. PROBE marks a capacity probe. URGENT asks a writer to drain the object before queued media.

5.3. Classes and Priorities

The class field selects the body grammar.

Table 7: Fragment classes
Value Name Description
0 CONTROL Lane handshake, session control, input, and close
1 CURSOR Pointer position and shape
2 MEDIA Opaque media updates and parity objects
3 FEEDBACK Acknowledgements, reports, probes, and probe echoes
4 PATH Path hints and path changes

Values 5 through 255 are not defined in version 1 and are rejected with BAD_CLASS. Section 12 defines the registry. The PATH class carries path hints; version 1 defines no body for it, and a receiver ignores its payload.

The priority field is an integer from 0 to 7, where 0 is the highest priority. Values above 7 are rejected with BAD_PRIORITY. A MEDIA-class fragment MUST NOT use priority 0 or 1: those are reserved for control, input, and feedback, and the pacer's reserved rate depends on them. Within the MEDIA class, 6 is interactive media and 7 is background refresh. The assigned defaults are:

Table 8: Default priority assignments
Priority Use
0 Control and acknowledgements
1 Input
2 Feedback reports and probe echoes
3 Hop reports
4 Unassigned
5 Cursor
6 Interactive media
7 Background refresh

5.4. Header Extension

The header extension is a sequence of zero or more type-length-value (TLV) runs:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+---------------+-------------------------------+
|     type      |     length    |            value ...          |
+---------------+---------------+-------------------------------+

type is a u8. length is a u8 and gives the number of value bytes, from 0 through 255. The value is length bytes. The extension is the concatenation of whole runs; header_ext_len is either 0 or between 2 and 256 inclusive. A run whose length would cross the end of the extension is a BAD_EXT error, and the whole fragment is rejected.

A receiver MUST skip a TLV whose type it does not recognize, using the length to advance. A hop that forwards a fragment MUST preserve the extension byte for byte, including runs it does not understand. The extension is not reordered or rewritten.

A receiver that finds the same TLV type twice with different values, or a TLV that contradicts the body it mirrors, MUST reject the object with META_MISMATCH. It MUST NOT choose one of the two values.

5.5. Header Extension TLV Registry

The following types are defined in version 1. A type not listed is either unassigned or experimental and is skipped.

Table 9: Header extension TLV types
Type Name Length Class Description
0x01 UPDATE_ID 8 C3 The update this fragment belongs to.
0x02 UPDATE_BASE 8 C3 The update this one continues; 0 means self-contained.
0x03 PART 4 C3 This fragment's part within its update.
0x04 UPDATE_BYTES 4 C3 The update's total payload bytes.
0x05 CHAIN_EPOCH 4 C3 The chain epoch.
0x06 REFLECTS_INPUT_SEQ 8 C3 The highest input sequence the update's content includes.
0x07 SEND_EPOCH_MS 8 C3,C4 The sender's session-relative millisecond at first emission.
0x08 DEADLINE_EPOCH_MS 8 C3,C4 The absolute session-relative deadline.
0x09 ECHO_OF_OBJECT_ID 4 C4 The object being echoed or acknowledged.
0x0A BUDGET_BYTES 4 C4 The sender's per-update budget.
0x0B PACE_BPS 4 C4 The sender's current pace.
0x0C PATH_HINT 1 C5 0 unknown, 1 stream, 2 dc-direct, 3 dc-turn, 4 quic.
0x0D INPUT_SEQ 8 C1 The input object's sequence.
0x0E CELL_COUNT 4 C3,C4 The sender's repair-grid size.
0x0F COST_MS 2 C4 A hop's measured processing cost.
0x10 STREAM_ID 4 C3 The media stream this update belongs to; 0 is the default stream.
0x11 FEC_GROUP_ID 8 C3 The update id whose parts this parity object protects.
0x12 FEC_K 2 C3 How many parts the protected group holds, 2..8.
0x13 PATH_ID 1 C3,C5 The path this fragment was sent over; 0 is the default path.
0x14 FEC_N 2 C3 How many repair rows the group carries.
0x15 FEC_REPAIR_INDEX 2 C3 Which repair row this parity object carries.

Types 0x16 through 0xEF are unassigned and are skipped by a version 1 receiver. Types 0xF0 through 0xFF are experimental: they are skipped and counted. A receiver MUST NOT treat an unknown type as an error.

When a TLV is present, its length must equal the length in the table; a TLV with a different length is malformed and the fragment is rejected with BAD_EXT (or, when the value is used to mirror the body, META_MISMATCH).

5.6. Fragment Validation

A receiver validates a fragment in the following order. The order is normative: a receiver MUST NOT examine a later step before an earlier step has passed.

  1. The transport message is at least 22 bytes; otherwise BAD_LENGTH.

  2. The first four bytes are 4d 4c 50 00; otherwise BAD_MAGIC.
  3. version is 1; otherwise UNSUPPORTED_VERSION.
  4. class is 0 through 4; otherwise BAD_CLASS.
  5. Bit 7 of flags is zero; otherwise BAD_FLAGS.
  6. priority is 0 through 7, and a MEDIA fragment does not use 0 or 1; otherwise BAD_PRIORITY.
  7. fragment_count is 1 through 4096 and fragment_index is less than fragment_count; otherwise BAD_FRAGMENT.
  8. header_ext_len is 0 or between 2 and 256 inclusive; otherwise BAD_EXT.
  9. payload_len is at most the carrier's fragment payload cap; otherwise BAD_LENGTH.
  10. The message contains the whole extension and body, and the extension is a sequence of whole TLVs; otherwise BAD_LENGTH or BAD_EXT.
  11. On a datagram carrier, the message carries exactly one fragment and fragment_count is 1; otherwise BAD_FRAGMENT.

After the header passes, the receiver applies the object rules of Section 5.7 and then the class-body rules of Section 6. A receiver MUST NOT report an error for a fragment whose header is malformed; the fragment is dropped and counted, and the error is reported only when the protocol can name an object.

5.7. Object Assembly

An object is complete when every fragment index from zero through fragment_count - 1 has arrived and a fragment with FIN has been seen. The object's payload is the concatenation of the fragment payloads in index order. The object's class, flags, and priority are those of fragment index 0, and its header extension is the extension of fragment index 0. A sender MUST set the same class, flags, priority, and extension on every fragment of an object; a receiver that finds a different class or a different fragment_count rejects the fragment with BAD_FRAGMENT.

Object state is per lane and direction and is bounded:

  • at most 4 objects open at once;

  • at most 1 MiB of payload held across incomplete objects;

  • a deduplication window of 4096 (object_id, fragment_index) pairs.

When a new fragment would exceed either the object count or the byte budget, the receiver evicts the oldest incomplete object and counts ASSEMBLY_EVICTED. An incomplete object that has been open for 3 x RTT + 500 ms is discarded and counted ASSEMBLY_TIMEOUT. The timestamp is the arrival of the object's first fragment.

A fragment whose (object_id, fragment_index) pair is already inside the deduplication window is a duplicate and is dropped. A fragment whose DEADLINE_EPOCH_MS is present and non-zero and has passed is dropped as expired; this is a local drop and is not reported to the peer.

A partial object is never delivered to the application, and a hop never forwards one. A hop reassembles an object and replays its original encoded bytes; it does not re-encode the body.

5.8. Update Model

An update is the protocol's unit of media state. It consists of one or more parts. Each part is carried as exactly one object, and each object is carried as one or more fragments. The mapping is therefore:

update
  +-- part 0  -> object -> fragment 0 .. fragment n-1
  +-- part 1  -> object -> fragment 0 .. fragment n-1
  +-- ...

A self-contained update carries UPDATE_BASE = 0 and may be applied onto any state the receiver holds. A chained update carries UPDATE_BASE > 0, the identifier of the update it continues, and may be applied only onto exactly that state. A receiver that does not hold the named base refuses the update and reports the base it does hold.

The sender sets UPDATE_BASE to the last update the receiver confirmed, not to the last update the sender emitted. An unconfirmed update may never have been applied, and a delta that extends it would be refused. The content layer marks an update as absolute when its content is absolute, and the sender MUST carry that mark as ANCHOR. The sender SHOULD produce an anchor update when it knows the receiver cannot chain: a gap, a resume, an epoch change, or an unacknowledged update.

The update metadata is carried in the header extension of every part. The fields are:

Table 10: Update metadata
TLV Meaning
UPDATE_ID The update this part belongs to.
UPDATE_BASE The update this one continues; 0 means self-contained.
PART The part index and the part count of the update.
UPDATE_BYTES The total payload bytes of all parts, excluding framing. It is diagnostic and MUST NOT be compared with an encoded object's length.
CHAIN_EPOCH The sender's chain epoch.
REFLECTS_INPUT_SEQ The highest input sequence whose effect the update's content includes.
SEND_EPOCH_MS The sender's session-relative millisecond at first emission; preserved verbatim on a retransmit.
STREAM_ID The media stream; version 1 defines only stream 0.
PATH_ID The path the fragment was sent over; 0 is the default path.
CELL_COUNT The sender's coverage grid size, for the staleness arithmetic.

A part count of 1 and a part count of 8 are both legal; the sender's per-update budget and the carrier's fragment cap bound the parts. A single-part update has no parity object, because its parity would be a byte copy of the part.

5.9. Identities and Monotonicity

MLP has four identities, and they mean different things.

Table 11: Identities
Identity Space Meaning Not a signal for
object_id Monotone per lane, direction, and sender epoch One object, for deduplication and for ECHO_OF_OBJECT_ID Loss: a gap is not a lost object
UPDATE_ID Monotone per lane, direction, and receiver One media update, for the acknowledgement window and convergence A codec's private counter
CHAIN_EPOCH Monotone per session, sender-owned A break in the update chain A per-update counter
input_seq Monotone per receiver epoch One input object, for deduplication and echo A media update identifier

The object_id space is per sender because a lane carries objects from several senders: the media sender and any intermediary that originates its own control or report object. A gap in the object-id sequence is not a lost media update. The update-id space is the media sender's own and is the only space in which a gap means "the receiver never saw this update". A receiver that reports the object-id gap as loss reports an intermediary's own object as a lost update, and the sender's estimator then reads a clean link as a lossy one.

object_id is a 32-bit field with the value 0 reserved. A sender MUST NOT reuse an identifier that is still inside a receiver's deduplication window. When the counter would wrap, the sender MUST establish a new session or advance the sender epoch; it MUST NOT silently reuse an identifier.

UPDATE_ID is a 64-bit field and starts at 1. A value of 0 in an acknowledgement means "nothing applied yet".

CHAIN_EPOCH is a 32-bit field and only moves forward. A receiver adopts a greater epoch and never a smaller one. An acknowledgement that names an older epoch is a stale acknowledgement; the sender MUST count it and MUST NOT move its epoch back.

5.10. Coverage Grid

The sender partitions its surface into a rectangular grid of cells. The grid is negotiated in the handshake: cell_size, cell_cols, and cell_rows in MediaHello and MediaHelloAck. The cell size is a power of two between 32 and 256 pixels. The grid is indexed row-major: cell row x cols + col.

A grid with width and height pixels and cell size s has ceil(width / s) x ceil(height / s) cells. The sender SHOULD choose the smallest power-of-two cell size that keeps the grid at or below 2048 cells; for a 1920x1080 surface that is 32 pixels and a 60x34 grid. A surface that would exceed 2048 cells at the maximum cell size of 256 pixels MUST be downscaled before encoding; the bound is reached at roughly 11585 pixels on a side.

The grid is an accounting partition, not a content format. The content layer tells the sender which cells an update covers; the transport performs set arithmetic over those indices and never inspects the cells' content. A receiver that does not implement cell-level accounting MAY report applied_cell_count and stale_cells as zero; the update-level acknowledgement remains authoritative.

A geometry change advances the chain epoch. Every cell the sender emitted in the previous epoch becomes suspect again; nothing is erased, because the honest degradation is to keep showing what the receiver has and mark it.

6. Class Bodies

6.1. Body Encoding

The class bodies are encoded with a restricted Protocol Buffers wire format. Only three wire types are used:

Table 12: Wire types
Wire type Encoding Used for
0 Base-128 varint u32, u64, bool, enum
1 64-bit little-endian double
2 Length-delimited: varint length followed by bytes string, bytes, nested message

A field is encoded as a varint key (field_number << 3) | wire_type followed by the value. Field numbers 1 through 536870911 are legal; field number 0, wire types 3 and 4 (groups), and wire type 5 (fixed32) are not used by this document and MUST be rejected as BODY_INVALID. A decoder MUST skip an unknown field by its wire type, so a future extension can be added without changing this grammar.

A scalar field with its default value (zero, false, or the empty string) is omitted by the encoder and read as the default by the decoder. A repeated field is encoded as zero or more key/value pairs. A nested message is length-delimited. A body that contains more than one field of a oneof is invalid; the decoder MUST reject it with BODY_INVALID, not silently take the last one.

The complete schema is Appendix B. The tables below state the field numbers and the semantics a peer needs.

6.2. MEDIA

The MEDIA class carries opaque bytes. The protocol does not define, validate, or inspect their content; a codec does. The protocol fragments the bytes across the carrier, reassembles them, paces them, and accounts for them. It never slices the content spatially and never interprets a part.

A media object MUST carry an UPDATE_ID TLV. An object without one cannot be acknowledged and is rejected with BODY_INVALID. A media object whose priority is 0 or 1 is rejected with BAD_PRIORITY.

6.3. CURSOR

The CURSOR class carries pointer position and, optionally, a pointer shape. It is unordered, latest-wins, and never retransmitted. A cursor object MUST NOT be fragmented: fragment_count MUST be 1, and the payload MUST fit the carrier's cap. A cursor object larger than the cap is dropped by the sender and counted.

Table 13: MediaCursor fields
Field Type Name Meaning
1 i32 x_px Pointer x in surface pixels.
2 i32 y_px Pointer y in surface pixels.
3 bool visible Whether the pointer is visible.
4 u32 shape_seq Local shape generation; 0 means keep the local shape.
5 u64 epoch_ms The sender's session-relative time of the sample.
6 u32 hot_spot_x Shape hot spot x, when a shape is carried.
7 u32 hot_spot_y Shape hot spot y, when a shape is carried.
8 bytes shape_rgba Optional shape, at most 8192 bytes.

A receiver validates a cursor body as follows: shape_rgba is at most 8192 bytes; and if visible is true, shape_seq is 0, and shape_rgba is non-empty, the body is invalid. A position outside the surface is clamped, not rejected: a pointer outside the surface is normal during a geometry change. A receiver that cannot use the shape keeps its local one.

6.4. FEEDBACK

The FEEDBACK class carries the receiver's acknowledgement and measurement report, the probe exchange, and the hop report. The body is selected by the priority and the flags:

Table 14: FEEDBACK body selection
Priority Flags Body
0 Any MediaAck
2 PROBE set MediaProbe
2 ECHO_OF_OBJECT_ID TLV present ProbeEcho
2 Otherwise MediaFeedback
3 Any MediaHopReport

A receiver MUST reject a feedback object that does not match one of these shapes with BODY_INVALID. A sender that emits a bare MediaAck MUST use priority 0; a sender that nests the acknowledgement in MediaFeedback uses priority 2 and leaves the bare-ack shape unused.

6.4.1. MediaAck

A MediaAck is the receiver's selective acknowledgement of the updates it has applied. It is valid both as a bare priority-0 feedback body and as the ack field of a MediaFeedback.

Table 15: MediaAck fields
Field Type Name Meaning
1 u64 highest_applied_update_id The highest update the receiver applied; 0 means nothing applied yet.
2 u64 ack_bitmap Bit i names update highest - i, for i in 0..63.
3 u32 chain_epoch The chain epoch the receiver has adopted.
4 u32 applied_cell_count The receiver's grid size.
5 u32 stale_cells The number of cells the receiver believes stale.
6 bool converged The receiver's own convergence belief.
7 double render_latency_ms Measured render latency, when meaningful.
8 bool has_render_latency_ms Whether field 7 is meaningful.
9 u64 echo_of_input_seq The highest input sequence visible in the applied content.
10 u64 ack_epoch_ms The reporter's session-relative time; diagnostic only.

The window is 64 updates wide. A set bit i MUST satisfy i < highest_applied_update_id; otherwise the acknowledgement is invalid (ACK_BAD_BITMAP, reported on the wire as BODY_INVALID). A receiver that reports fewer bits than the field holds is a different receiver: the sender reads the missing bits as "not applied" and re-sends content the receiver already holds.

stale_cells MUST NOT exceed applied_cell_count (ACK_BAD_COUNT). If has_render_latency_ms is false, render_latency_ms MUST be zero.

converged is the receiver's belief about its own surface. The sender's accounting is authoritative for the lane state; the receiver's bit is a report, not a command.

6.4.2. MediaFeedback

MediaFeedback is the receiver's measurement report. A report that closes a measurement window carries the window's counters and a non-zero window_ms. A prompt report, sent because the receiver holds an echo or a loss attribution the sender cannot wait for, carries window_ms = 0 and is a sign of life, not a measurement.

Table 16: MediaFeedback fields
Field Type Name Meaning
1 u32 rtt_ms The receiver's measured round trip, clamped to 1..60000.
2 u32 rtt_min_ms The receiver's running minimum.
3 u32 jitter_ms The receiver's jitter estimate.
4 u64 received_bytes Payload bytes received in the window.
5 u64 received_objects Objects received in the window.
6 u64 lost_objects Updates the receiver never saw, counted in the update-id space.
7 u64 duplicated_objects Objects seen twice in the window.
8 u64 reordered_objects Objects that arrived out of order.
9 u64 window_ms The window length; 0 means the window is still open.
10 message ack A MediaAck.
11 repeated message probes ProbeEcho values, when the report carries echoes.
12 u32 buffered_amount_bytes The receiver's outbound backlog.
13 u32 display_fps The measured display rate.
14 u32 render_ms_p50 Render time, median.
15 u32 render_ms_p95 Render time, 95th percentile.
16 u32 input_queue_depth The receiver's input queue depth.
17 u64 input_submitted Input objects submitted in the window.
18 u64 input_expired Input objects expired in the window.
19 u64 path_switches Carrier switches observed.
20 u32 active_path The active carrier (Section 6.4.5).
21 string app_version Diagnostic application identifier.
22 u32 loss_bursts The number of loss bursts in the window.
23 u32 lost_in_bursts Updates lost in bursts.
24 u32 max_burst The longest burst in the window.
25 u32 mean_burst_ewma_x16 The EWMA mean burst length, times 16.

Two derived values are normative:

goodput_bps = received_bytes * 8000 / window_ms     (window_ms > 0)
delivered_ratio = received / (received + lost_objects)
loss_ratio = 1 - delivered_ratio

received_bytes counts payload bytes only; framing bytes and the header extension are not counted. lost_objects is counted in the update-id space, not the object-id space. A report with window_ms = 0 has no goodput and no loss ratio: the sender MUST treat it as an acknowledgement and a sign of life and MUST NOT move its measurement filters on it.

6.4.3. MediaProbe and ProbeEcho

A probe is a FEEDBACK object with the PROBE and ECHO_REQUESTED flags set and a SEND_EPOCH_MS TLV. Its body is a MediaProbe.

Table 17: MediaProbe fields
Field Type Name Meaning
1 u32 probe_id A prober-local identifier; not an identity.
2 u32 payload_bytes The probe's payload size.
3 u64 send_epoch_ms The sender's session-relative emission time.

An echo answers a probe. It is a FEEDBACK object at priority 2 with an ECHO_OF_OBJECT_ID TLV and a SEND_EPOCH_MS TLV copied verbatim from the probed object. Its body is a ProbeEcho.

Table 18: ProbeEcho fields
Field Type Name Meaning
1 u32 object_id The object being answered.
2 u64 send_epoch_ms The prober's epoch, quoted verbatim.
3 u64 echo_epoch_ms The echoer's session-relative reply time.
4 u32 payload_bytes The answered probe's payload size.

The correlation is the object_id in the TLV, not probe_id. A hop that does not decode a body can read the TLVs and measure its own round trip. The echo is an object of its own, not a field of the next report; a receiver that has no echo to send sends none.

6.4.4. MediaHopReport

A hop reports what it dropped at FEEDBACK priority 3. The priority is the discriminator: a hop report is the only FEEDBACK body at priority 3.

Table 19: MediaHopReport fields
Field Type Name Meaning
1 u32 hop 1 first intermediary, 2 edge, 3 datagram, 4 relay.
2 u64 objects_dropped Objects this hop discarded in the window.
3 u64 bytes_dropped Bytes discarded in the window.
4 u64 coalesced Objects coalesced in the window.
5 u32 queue_depth_peak Peak queue depth observed.
6 u32 queue_depth_current Current queue depth.
7 u32 window_ms The interval the report covers.
8 u32 rtt_ms_own The hop's own round trip to the next hop.
9 u32 backpressure_ms Time the writer waited on capacity.

A sender that receives a hop report subtracts the reported drops from the receiver's loss; the remainder is the unattributed loss. A hop that cannot produce a report sends none.

6.5. CONTROL

The CONTROL class carries a single MediaControlObject, a oneof whose field numbers are fixed by this document.

Table 20: MediaControlObject oneof
Field Body Direction
1 MediaHello Sender to receiver
2 MediaHelloAck Receiver to sender
3 MediaResume Receiver to sender
4 MediaResumeAck Sender to receiver
5 MediaLaneState Sender to receiver
6 Reserved MUST NOT be sent
7 MediaClose Either direction
8 MediaError Either direction
9 MediaPathChange Either direction
10 MediaDatagramSignal Either direction

A control object MUST contain exactly one field of this oneof. A body with zero or with more than one field is rejected with BODY_INVALID. Handshake, resume, close, and error objects are urgent and are drained ahead of queued media; lane state and path change are informational.

6.5.1. MediaHello

Table 21: MediaHello fields
Field Type Name Meaning
1 u32 protocol_version 1.
2 string media_session_id Empty for a fresh session; non-empty only in a resume.
3 string session_id The control-lane session identifier.
4 u32 max_fragment_payload The sender's fragment payload cap: 1150 on a datagram carrier, 65536 on a stream carrier.
5 u32 cell_size The coverage grid's cell size.
6 u32 cell_cols The grid's column count.
7 u32 cell_rows The grid's row count.
8 repeated string capabilities Capability names, Section 7.1.
9 u32 encoder_max_fps The sender's encoder ceiling.
10 u64 start_epoch_ms The sender's session-relative start time.

A MediaHello whose protocol_version is not 1 is rejected with UNSUPPORTED_VERSION. The sender's fragment payload cap is a claim; the receiver's answer is the minimum.

6.5.2. MediaHelloAck

Table 22: MediaHelloAck fields
Field Type Name Meaning
1 u32 protocol_version 1.
2 string media_session_id The assigned media session identifier.
3 u32 accepted_fragment_payload The minimum of the two sides' caps.
4 u32 cell_size The agreed cell size.
5 u32 cell_cols The agreed column count.
6 u32 cell_rows The agreed row count.
7 repeated string capabilities The receiver's capabilities.
8 u32 resume_ttl_seconds The resume TTL; 0 means resumption is not offered.
9 bool media_supported Whether the lane is admitted.
10 string media_unsupported_reason Required when field 9 is false.

When media_supported is false, the reason MUST be one of protocol, disabled_by_policy, or no_sender_capability. The session continues; only the media lane is refused.

6.5.3. MediaResume

Table 23: MediaResume fields
Field Type Name Meaning
1 string resume_token An opaque bearer token.
2 u64 applied_update_id The last update the receiver applied.
3 u32 chain_epoch The epoch the receiver holds.
4 u64 ack_bitmap The receiver's acknowledgement window.
5 u64 input_seq_next The receiver's next input sequence: the deduplication boundary.
6 repeated u32 pressed_keys Keys the receiver currently holds.
7 repeated u32 pressed_buttons Buttons the receiver currently holds.
8 u32 active_path The carrier the receiver believes is active.
9 string dc_transport_id A fresh negotiation identifier when the receiver renegotiated.

6.5.4. MediaResumeAck

Table 24: MediaResumeAck fields
Field Type Name Meaning
1 bool accepted Whether the parked state was attached.
2 string reason A resume reason (Section 7.4).
3 u64 next_update_id The update identifier the sender will use next.
4 u64 pending_cells The cells the sender will cover in its next whole state.
5 u32 pace_bps The current pace.
6 u32 budget_bytes The current per-update budget.
7 u32 target_fps The current target rate.

6.5.5. MediaLaneState

Table 25: MediaLaneState fields
Field Type Name Meaning
1 u32 state 0 STARTING, 1 LIVE, 2 DEGRADED, 3 CONVERGING, 4 STALE, 5 PARKED, 6 DISABLED, 7 DECODE_BOUND, 8 NO_FEEDBACK, 9 MEDIA_UNSUPPORTED.
2 u64 since_epoch_ms When the state was entered.
3 string detail A diagnostic detail string.

The states and their transitions are normative in Section 7.2.

6.5.6. MediaClose

Table 26: MediaClose fields
Field Type Name Meaning
1 u32 code 0 normal, 1 server_shutdown, 2 policy, 3 superseded, 4 park.
2 string reason A human-readable reason.
3 bool park The "come back" signal; a receiver MUST NOT treat it as a failure.

6.5.7. MediaError

Table 27: MediaError fields
Field Type Name Meaning
1 u32 code An error code from the registry in Section 12.
2 u32 object_id The object the error concerns; 0 when none.
3 string detail A diagnostic detail string.

A MediaError whose code is not in the registry is invalid (BODY_INVALID). An implementation MUST NOT send an error for a duplicate, an expired object, or a superseded object: those are local drops and reporting them is noise.

6.5.8. MediaPathChange

Table 28: MediaPathChange fields
Field Type Name Meaning
1 u32 from_path 0 unknown, 1 stream, 2 dc-direct, 3 dc-turn, 4 quic.
2 u32 to_path The new carrier.
3 string reason A diagnostic reason.
4 u64 at_epoch_ms The sender's session-relative time of the switch.

6.5.9. MediaDatagramSignal

The datagram setup is a oneof carried on the control lane, never on the carrier it establishes.

Table 29: MediaDatagramSignal oneof
Field Body Fields
1 MediaDatagramOffer 1: string sdp
2 MediaDatagramAnswer 1: string sdp
3 MediaDatagramCandidate 1: string candidate; 2: string sdp_mid; 3: u32 sdp_mline_index
4 MediaDatagramClose 1: string reason

The SDP and candidate strings are carried verbatim [RFC8866] [RFC8445]. The sender is the offerer; the receiver answers. A peer that cannot carry the carrier ignores the offer.

6.6. Input Objects

An input object is a CONTROL-class object at priority 1. Its body is not a protobuf message; it is the following little-endian envelope:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------------------------------------------------------+
| "input" (5 bytes)                                             |
+---------------------------------------------------------------+
| input_seq (u64)                                               |
+---------------------------------------------------------------+
| deadline_epoch_ms (u64)                                       |
+---------------------------------------------------------------+
| kind (u8)     | flags (u8)    | payload_len (u16)             |
+---------------------------------------------------------------+
| payload (payload_len bytes)                                   |
+---------------------------------------------------------------+

The five-byte ASCII marker input is the body's identity. A body without the marker is not an input envelope; a peer that does not implement the wrapper forwards it unchanged. The fixed part is 25 bytes and payload_len MUST equal the number of bytes that follow it.

Table 30: Input kinds
Value Kind
0 pointer_move
1 pointer_button
2 key
3 wheel
4 clipboard
5 release_all
6 pressed_set

flags is a bit field: 0x01 RELEASE, 0x02 REPEAT, 0x04 CRITICAL. Unknown bits MUST be ignored. The pressed-set payload is u32 key_count || u32 keys... || u32 button_count || u32 buttons....

7. Session Lifecycle

7.1. Handshake

A media lane begins with a MediaHello from the sender followed by a MediaHelloAck from the receiver. The hello is the first object on the media lane; the sender MUST NOT send a media update before the acknowledgement arrives.

The hello negotiates:

  • the protocol version, which is 1;

  • the media session identifier: empty for a fresh session, and assigned by the receiver in the acknowledgement;

  • the fragment payload cap: the receiver accepts the minimum of the two sides' caps;

  • the coverage grid: cell size, columns, and rows;

  • the capabilities each side offers;

  • the sender's encoder ceiling and session start time;

  • the resume TTL, when the receiver offers resumption.

The following capability names are defined. A capability name is an ASCII string; an unknown name MUST be ignored.

Table 31: Capabilities
Name Meaning
anchor The peer supports anchor updates and may apply them onto any held state.
cursor The peer supports CURSOR objects.
dupe The peer supports echo-critical duplication.
probe The peer supports probes and probe echoes.
datagram The peer supports a WebRTC data-channel carrier.
hop_report The peer supports hop reports on a deployment-defined hop channel.

Version 1 defines no version negotiation. A peer that receives a MediaHello or MediaHelloAck whose protocol_version is not 1 MUST refuse the lane with UNSUPPORTED_VERSION. A future version is defined by a future document and uses a different value; a version 1 peer MUST NOT attempt to interpret a fragment from another version.

If the receiver cannot admit the lane, it answers with media_supported = false and a typed reason. The session continues; only the media lane is refused. The reason is one of protocol, disabled_by_policy, or no_sender_capability.

7.2. Lane States

A lane has two observers. The sender publishes MediaLaneState: the state of the link as the sender sees it. The receiver publishes its own state: the state of the content as the receiver sees it. Both are computed from the same three facts, each measured by the end that can measure it.

Table 32: The three facts
Fact Receiver measures Sender measures
Freshness The time since the last applied update The time since the receiver's applied-update watermark advanced
Convergence The cells it believes stale The pending set the acknowledgement names
Quality The loss it attributed in the update-id space The same ratio, read from the feedback

The states, in precedence order, are:

Table 33: Lane states
State Entered when Left when
MEDIA_UNSUPPORTED The peer does not speak this version, or policy forbids the lane. Terminal.
DISABLED Media is switched off by policy or a kill switch. The switch is cleared.
STARTING The handshake has not completed. The handshake completes.
PARKED The peer is away and its state is held. The peer resumes, or the park TTL expires.
NO_FEEDBACK No sign of life for 3 x report_interval + 2 s. One sign of life: a report, an acknowledgement, or a probe echo.
STALE No update applied within 3 x (report_interval + 1 s). One update is applied.
DECODE_BOUND The receiver reports a decode time above half the update interval, and the sender implements decode-bound clamping. The decode time falls below the threshold.
CONVERGING The receiver holds cells the sender emitted, above 25% of the grid. The pending set is empty or at or below 25%.
DEGRADED The attributed loss ratio is above 5%. The ratio is back at or below 5%.
LIVE None of the above applies. Any fact leaves its condition.

The precedence order is: MEDIA_UNSUPPORTED > DISABLED > STARTING > PARKED > NO_FEEDBACK > STALE > DECODE_BOUND > CONVERGING > DEGRADED > LIVE. An end reports the most significant state that applies.

Neither end's LIVE overrides the other's staleness. A receiver whose own freshness is exhausted MUST report STALE whatever the sender last said; a sender that has seen no advancing watermark within the budget MUST report STALE whatever the receiver last reported.

An implementation that does not measure decode time never enters DECODE_BOUND; the state is defined so that an implementation that does measure it has a name for the result. The pace is not evidence. A sender with little to send sits at the pace floor on a perfect link, so a lane MUST NOT be reported DEGRADED because its pace is below a nominal rate. Loss is the quality fact both ends can measure.

A lane that is open but stalled -- the carrier is up, objects flow, acknowledgements arrive, and the content does not advance -- is STALE. It is not DEGRADED (nothing was lost) and not LIVE (the content is not advancing). The first update the receiver applies ends the state.

7.3. Parking

Parking retains a session's state after its carrier fails, so that a returning peer can resume it. The session's owner keeps the session record: the peer's identity, the media session identifier, the lane's tokens, the last statistics, and the lane mode. The sender keeps the per-receiver state: the epoch, the pending set, the update-identifier counter, the acknowledgement ring, the budget and pace, the pressed set, and the path statistics.

The park TTL is clamp(2 x outage_target + 60 s, 120 s, 900 s); a deployment with no configured outage target uses 300 seconds. The resume token's TTL is advertised in MediaHelloAck and is independent of the park TTL; a token whose TTL has passed is refused with token_expired.

A parked session accrues a repair obligation. Content production continues, the sender's emitted state advances, and nothing is sent to the parked peer. The resume uses the last confirmed update and the pending set to decide what the next whole state must cover.

A lane that names a parked session resumes it, and the park is consumed. A lane that ends inside the resume grace keeps the park, so a peer that re-registers does not cost its counterpart the session.

7.4. Resume

A resume token is an opaque bearer string. The protocol does not define its format; that is the deployment's, because the token is a statement about the deployment's sessions. The protocol requires:

  • the token MUST be unforgeable by anyone who does not hold the session's identity;

  • it MUST carry, or be bound to, the session, the peer that may resume it, and a single-use generation;

  • the generation MUST advance on every use, so a replayed token is detectable and refused;

  • it MUST expire, and the expiry MUST be enforced by the party that validates it;

  • it MUST be signed or encrypted under a key that has an identifier, and the validator MUST reject a token whose key it does not hold.

A deployment MUST be able to accept more than one key at a time. The overlap between a new key's first issue and an old key's retirement MUST be at least one resume TTL. Removing a key revokes every token it signed. The token is opaque to the receiver; a client MUST NOT parse it, construct one, or send it to any party but the issuer.

The resume exchange is:

receiver                    session owner                 sender
  |-- reconnect control -------->|                            |
  |   handshake{resume_token}    |                            |
  |<-- handshake{resumed} -------|                            |
  |-- open media lane ---------->|                            |
  |   MediaHello{} + MediaResume{token, applied_update_id,    |
  |     epoch, ack_bitmap, pressed_*, input_seq_next}         |
  |                              |-- attach parked session -->|
  |                              |<-- MediaResumeAck ---------|
  |<-- MediaHelloAck + MediaResumeAck -----------------------|
  |-- the same content, the same chain ---------------------->|

The MediaResumeAck.reason values are:

Table 34: Resume reasons
Reason Meaning Action
ok The parked state was attached. Rebase and continue.
unknown_session No such session exists. Start a fresh session.
token_expired The token's expiry has passed. Start a fresh session.
token_invalid The token's signature or shape is invalid. Start a fresh session.
peer_mismatch The token names another receiver or sender. Terminal for this token.
epoch_stale The receiver's epoch is older than the sender's. Start a fresh media session.
epoch_mismatch The receiver's epoch differs but is not older. Rebase; the sender adopts the greater epoch.
park_evicted The parked state was evicted. Start a fresh media session.

If the resume is refused with park_evicted or epoch_stale, the sender starts a fresh session for the same receiver: a new media session identifier, chain_epoch++, and one anchor update. There is no control-lane re-handshake.

Sequence continuity is preserved: the object_id counter continues and is never reset by a resume; the update identifier continues per receiver; and the input sequence space continues, with input_seq_next in MediaResume as the deduplication boundary.

A receiver that resumes MUST NOT clear its content. The honest degradation of a lost link is to keep showing what it has and mark it stale, not to go blank.

7.5. Close

A MediaClose is a protocol object, not a carrier close. It carries a code and a park flag. The codes are 0 normal, 1 server_shutdown, 2 policy, 3 superseded, and 4 park. A close with park = true is the "come back" signal: the receiver MUST NOT treat it as a failure, and it reconnects according to the ladder.

A carrier close without a MediaClose is an ungraceful end. The session enters the reconnect ladder; the sender keeps the per-receiver state until the park TTL expires.

7.6. Reconnect Ladder

The receiver's reconnect ladder is RTT-relative and unbounded. Let base = max(500 ms, RTT_smoothed). The delay before attempt n is:

delay(0) = 0
delay(n) = clamp(base * 2^(n-1), 500 ms, 30 s) + jitter(0 .. 250 ms)

Attempts 0 through 2 retry the control lane. Attempts 3 through 5 also re-resolve the session and refresh the credential. Attempt 6 and beyond enter the suspended state: the interface shows that the session is not connected, the cadence is capped at 30 seconds, and retries continue.

The ladder gives up only on a failure that retrying cannot fix: an authorization failure, a retired or revoked session owner, an explicit disconnect, an unsupported protocol version, a park TTL that expired twice in a row, or an explicit operator action. Each is reported with a typed reason rather than a silent stop.

For any finite outage the peer reconnects. The T4 story of a 30-second outage and five 10-second flaps needs at most six attempts -- about 31 seconds of ladder time at a 1-second base, and about 60 seconds at a 2-second round trip, which is why the park TTL's floor is 120 seconds.

8. Delivery and Rate Adaptation

8.1. Overview

A sender runs three loops. The content loop turns a change in the content into one or more updates. The delivery loop tracks what each receiver has applied and what it may be missing. The capacity loop measures the link and sets the pace and the per-update budget. The loops are coupled only through the values they publish: the content loop consumes the budget, the delivery loop consumes the acknowledgement, and the capacity loop consumes the feedback.

8.2. Capacity Estimation

One estimator exists per (sender, receiver) pair. It is deterministic: every measurement derives from injected instants and the integer counters the receiver reports. It produces the pace, the per-update budget, the largest object, the target update rate, the mode, the loss ratio, and the round-trip and jitter estimates.

8.2.1. Capacity Probes

The estimator carries its own instrument. Every probe_interval (1 second) while the lane is live, it emits a probe at a rate above the current pace. The probe rate starts at 1 Mbps, doubles after a clean delivery, and halves after congestion, capped at the configured ceiling. A probe is a FEEDBACK-class object with the PROBE and ECHO_REQUESTED flags, a SEND_EPOCH_MS TLV, and a MediaProbe body. Its payload is clamp(0.25 s x pace / 8, 1 byte, 8192 bytes). The pacer releases it outside the token bucket and the one-second window, because a probe the pace throttles measures the pace, not the link.

At most one probe is outstanding. The managed probe rate is max(managed_rate, 1.25 x pace), capped at the ceiling; the headroom keeps the offer above the pace even after a congestion halving lands the managed rate on the capacity itself.

A probe is clean when it is delivered and the receiver reports a delivered ratio of at least 0.9. A clean probe raises the capacity to at least the probe rate and doubles the next probe rate. A probe that is lost, short, or unanswered sets the capacity to max(pace_floor, probe_rate x delivered_ratio), then raises it by the receiver's goodput, and halves the next probe rate. A probe whose echo does not arrive within 2 x RTT + 250 ms is a failed probe. A probe sent before the first round-trip measurement gets the no-feedback grace plus one probe interval as its deadline: its answer *is* the measurement, and a link that has never answered is the no-feedback case, not a lost probe.

The receiver's goodput is always a lower bound on capacity: a link that delivered bytes can carry at least that rate, whatever the sender paced at. The receiver's update-id gap loss is not a capacity signal; it is a delivery fact and the parity policy's input. A whole state supersedes the update the receiver missed, so the gap says nothing about what the link can carry.

8.2.2. Capacity Signals

  • Goodput. received_bytes x 8000 / window_ms, payload bytes only. It raises the capacity to at least its value.

  • Probe echoes. The round trip is now - SEND_EPOCH_MS on the sender's own clock. The two ends' session clocks are not compared.

  • Hop drops. When a hop reports objects_dropped, the drop fraction drops / (drops + received_objects) reduces the capacity, never below the floor. A coalesced object is not a drop.

  • Delay. queue_delay = RTT_ewma - RTT_min is recorded and reported; it is a congestion signal for the deployment and a diagnostic for the estimator.

RTT_min is the minimum over a 60-second sliding horizon. RTT_ewma uses alpha = 1/8. Jitter uses alpha = 1/4 over the absolute deviation from the previous smoothed value.

8.2.3. Estimator Modes

Table 35: Estimator modes
Mode Condition Effect
StartUp No capacity has been measured yet. Pace at the floor; the first probe asks for 1 Mbps.
Steady A capacity has been measured and the last probe was clean. Pace at the measured capacity.
Degraded The last probe found congestion. Pace at the reduced capacity; the next probe halves.
Floor The capacity is at the pace floor. Pace at the floor; media is limited to the essential classes.
NoFeedback No sign of life for 3 x report_interval + 2 s. Pace at 2 x floor, one update per second, no speculation.

The pace is min(capacity, ceiling), clamped to [8000, 50 000 000] bits per second. A deployment MAY lower the ceiling; it MUST NOT raise it above 50 Mbps.

8.2.4. Budgets

update_interval_ms = 1000 / target_fps
budget_bytes       = clamp((pace_bps / 8) *
                           update_interval_ms / 1000, 256, 1048576)
max_object_bytes   = clamp((pace_bps / 8) *
                           max(RTT_min, 0.5 s), 1024, 524288)
target_fps         = clamp(requested_fps, 0.5, 30)

max_object_bytes is bounded by roughly one round trip of airtime: an object larger than that cannot be delivered before the sender must decide what to do about it.

When budget_bytes is below min_delta_bytes = 8192, the scheduler lowers the update rate so that each update carries a worthwhile amount of content: target_fps = max(0.5, 30 x budget_bytes / 8192), floored at 1 while any receiver is live. The floor keeps an idle object at at least one per second, which keeps the acknowledgement timeline alive.

8.2.5. Priors

A sender MAY remember the rate a receiver's link sustained and start a new session at pace_0 = clamp(remembered_bps / 4, 8000, min(2 000 000, ceiling)). With no prior, the pace starts at the floor and the first probe asks for 1 Mbps, so a cold start on a slow link costs a few probe intervals before the rate is useful. That is why the first object is always an anchor update at the floor rate.

8.2.6. Missing Feedback

If no sign of life arrives for 3 x report_interval + 2 s, the estimator enters NoFeedback. The pace becomes 2 x pace_floor, the target rate becomes 1 update per second, and the maximum object becomes one report interval of that pace, clamped to [1024, 524288]. One sign of life clears the mode.

A sign of life is any object the peer sends: a report, an acknowledgement, or the echo of a probe this sender sent. A report is the estimator's measurement; the traffic is the proof that the lane is alive. Class C4 is reliable within a reporting window, and the loss of one report is harmless.

The grace is a function of the last known round trip, with a floor. A link that has measured a round trip keeps the grace that measurement earned; a link that has never answered gets the floor.

8.3. Pacing

Each lane has one token bucket per direction. The bucket's capacity is

capacity = min( max(2 * max_object_bytes, (pace_bps / 8) * 20 ms),
                max(1.25 * (pace_bps / 8) * 1 s, max_grant_bytes) )

and it refills at pace_bps / 8 bytes per second. The bucket starts full. The release unit is one fragment: on a stream carrier the pacer releases up to 64 KiB per poll; on a datagram carrier it releases at most one fragment.

max_grant_bytes is the carrier's fragment payload cap on a stream carrier (65536) and min(carrier cap, 16384) on a datagram carrier (1150 in practice). A request above it is the sender's segmentation bug, not a pacing problem.

The reserved rate is max(2000, 0.10 x pace_bps) bits per second. A media object may not be released if doing so would leave less than reserved_rate / 8 x max(RTT, 250 ms) bytes in the bucket. Non-media classes may borrow from the media tokens; the reverse never happens.

The pacer also enforces a one-second rolling window of max(1.25 x pace_bps / 8, max_grant_bytes) bytes. The window allowance is a burst allowance, not a sustained rate: the long-run average MUST NOT exceed the pace. A probe is released outside both the bucket and the window, as Section 8.2.1 describes.

An idle object is an empty update, update_bytes = 0, chained onto the current surface. It is emitted at most once per clamp(2 x RTT, 1000 ms, 3000 ms). It keeps the acknowledgement timeline and the lane alive, and it costs about 60 bytes.

8.4. Update Scheduling

An update is due every 1000 / target_fps milliseconds. The sender produces the update from the content layer's current state, splits it into parts, and hands the parts to the pacer.

On an input event for a receiver, the sender opens a pulse window of max(300 ms, RTT) and schedules an immediate update. During the window the target rate is min(30, max(4, 2 x target_fps)), and the pulse's budget is min(budget_bytes, max(1024, pace_bps / 8 x 0.25 s)). The pacer still enforces the pace, so a pulse can be delayed but can never violate the rate. The pulse carries REFLECTS_INPUT_SEQ.

A payload is split into at most max_parts parts, where the per-part size is min(491520, budget_bytes, carrier_cap). max_parts is 8 on a stream carrier, 4 on a datagram carrier, and 1 on a datagram carrier when the attributed loss is above 5%. An update that needs more parts than the cap is not sent as one oversized object; the sender produces several updates instead.

An object above max_object_bytes is dropped and counted, not sent. Its cells stay pending; the next whole state covers them.

8.5. Acknowledgements

A receiver acknowledges the updates it applied with a 64-update window. highest_applied_update_id names the newest applied update, and bit i of ack_bitmap names update highest - i. An update identifier of 0 means "nothing applied yet".

A receiver reports at the idle cadence clamp(4 x RTT_min, 250 ms, 2 s), and immediately when it holds a fact the sender cannot wait for: a new input echo, or a loss attribution. The prompt rate is bounded by clamp(RTT_min / 4, 25 ms, 250 ms). A prompt report carries window_ms = 0; the sender reads it as an acknowledgement and a sign of life, never as a measurement.

On an acknowledgement, the sender clears a cell from the pending set only when the update that last wrote that cell is among the applied updates. A cell rewritten by a later update stays pending until that later update is applied. This is stricter than clearing every cell of every applied update, and it is what makes the accounting correct when updates overlap.

The sender keeps a ring of update-to-cell mappings of max(64, ceil(2 x RTT / update_interval) + 8) updates. An acknowledgement for an update that has fallen out of the ring marks every cell emitted after the last applied update as pending again. This is conservative and correct, at the cost of re-sending a whole state; it is counted.

The chain epoch only moves forward. An acknowledgement that names an older epoch is stale: the sender counts it and leaves its epoch and its applied-update watermark alone. An acknowledgement that names a greater epoch is the receiver reporting a break the sender did not make; the sender adopts the greater epoch and sends an anchor update.

8.6. Convergence and Repair

A receiver has converged when its pending set is empty and the last update it applied is the last update the sender emitted. Both are reported. This is the operational form of the protocol's delivery promise.

MLP does not define a per-update retransmission timer. An update a receiver did not apply is superseded by a later whole state: the content layer re-encodes the current state, and the sender's accounting says which cells that state must cover. The sender SHOULD produce an anchor update when it knows the receiver cannot chain -- a gap, a resume, an epoch change, or an unacknowledged update -- and an anchor update may be applied onto any held state.

The protocol's repair obligation is therefore a set, not a schedule: the sender knows which cells each receiver may be stale in, and the next update that covers those cells repairs it. A deployment's content layer MAY produce a dedicated anchor update when the pending fraction is high; the transport does not require a particular repair cadence.

The grid is shared, but the pending set is per receiver. A receiver on a slow link never slows a receiver on a fast one. The number of concurrent receivers per sender is bounded; a new receiver beyond the bound is refused with no_sender_capability.

8.7. Forward Error Correction

Wire parity is an optional repair path for a lane whose loss is measured, not assumed. A group of k parts travels with n repair symbols, and any k of the group's k + n symbols rebuild all k parts. The code is systematic: the first k symbols are the parts themselves.

A sender attaches parity only when its freshest loss picture -- the last closed window, with prompt attributions folded in -- is at or above 2%. The repair count is:

  • inside the band 2% <= loss < 25%, the largest of 1, the window's longest burst, and ceil(8 x loss), capped at 8;

  • at or above 25%, zero: two losses in one group are common enough that parity only doubles the bytes a deep-loss lane cannot afford;

  • below 2%, one level lower per clean window, until zero;

  • with no loss signal at all, the previous count holds.

A group is one update's parts, and only an update with two or more parts takes parity. k is the part count and is at most 8; n is the repair count and is at most 8. A single-part update takes no parity: its parity would be a byte copy of the part.

Each parity object is a MEDIA-class object that follows the update's parts, carries the update's own metadata, and adds:

Table 36: Parity metadata
TLV Meaning
FEC_GROUP_ID The update identifier whose parts the group protects.
FEC_K The group's part count, 2 through 8.
FEC_N The group's repair count, 1 through 8; absent means 1.
FEC_REPAIR_INDEX The repair row this object carries, 0 through FEC_N - 1; absent means 0.

The parity payload is self-describing. Each part is a block u16 length || payload, zero-padded to the group's longest block. The blocks are combined over GF(256) with the polynomial 0x11D. Repair row r combines data column j with the Cauchy coefficient 1 / (r XOR (8 + j)); the two index ranges are disjoint, so the denominator never vanishes. Each row is followed by a u32 CRC-32 (IEEE) over the concatenated blocks in part-index order.

A receiver holds the newest eight groups' parts and repair rows by index. As soon as a group holds at least k of its k + n symbols with a part still missing, it reconstructs the missing parts, proves the result against the group's CRC, and delivers a recovered part exactly as a wire part: same metadata, same accounting, same acknowledgement. No round trip is spent. A group whose held symbols fail the CRC recovers nothing on that attempt; the next subset may still prove itself, and the repair path answers in the end. Wrong bytes never leave the recovery path.

A parity object obeys the same object cap, the same in-flight cap, and the same rate window as any media object. It is not free bandwidth; it is a trade of bytes for a round trip.

8.8. Duplicate Transmission

When the attributed loss is above 3% and the object is at most 2048 bytes, a sender MAY send a deliberate duplicate of an echo-critical object. The duplicate carries the DUP flag and the ECHO_OF_OBJECT_ID of the object it repeats. Application is idempotent by object_id and by (UPDATE_ID, PART): a receiver that has already applied the named object MUST NOT apply it twice.

Duplication is for the object that carries an input echo, not for the media bulk. Duplicating bulk content doubles the bytes a lossy lane can least afford.

9. Input Path

Input travels from the receiver to the sender. It is the path where a lost or duplicated object is most dangerous, because a lost key release leaves a key held forever. The rules are about boundedness, liveness, and honesty.

9.1. Input Object

An input object is a CONTROL-class object at priority 1. Its body is the input envelope of Section 6.6. The five-byte marker is the body's identity; a body without it is an input payload the peer does not wrap, and it is forwarded unchanged.

  • input_seq is monotone within a receiver's epoch and opaque to every peer except the receiver that produced it and the sender that consumes it.

  • deadline_epoch_ms is an absolute session-relative deadline; 0 means "never expires".

  • kind and flags are transport-level, so a hop can coalesce or drop an input object without decoding the payload.

  • payload is the input's own serialized content, unchanged by the transport.

9.2. Receiver Queue

The receiver's input queue is bounded at 64 objects and 8 KiB in total. Exceeding either bound drops the lowest-priority oldest object and counts the drop. The policies are:

Table 37: Input queue policies
Policy Rule
Capacity 64 objects and 8 KiB; drop the lowest-priority oldest object.
pointer_move Latest wins: a new move replaces an unsent move. While the transport is down, only the latest position is kept.
wheel Accumulated by direction into one object, capped at +/-8 notches.
key, pointer_button Never dropped while queued.
Release A RELEASE object is critical and bypasses the capacity drop.
clipboard Dropped when not connected, and never replayed: a stale paste is worse than no paste.
Deadline deadline_epoch_ms = now + input_deadline_ms; the default is 5000 ms. An expired object is removed and counted.
Replay on resume Queued objects are sent in input_seq order, skipping expired ones, followed by one pressed_set.
Local echo The pointer overlay only. The overlay's position is authoritative on a slow link. Keys are never echoed.

9.3. Hop and Sender Rules

  1. Session owner. The owner puts input objects at the head of the control lane. They are never coalesced and never dropped for capacity. The replay guard keys on (receiver_epoch, input_seq) with a 4096-entry window, and a frame that fails validation is rejected whole.

  2. Intermediary. An intermediary forwards input objects inline on the control lane, ahead of queued objects, subject to the session's rate limit. The forwarding is counted.

  3. Sender. The sender consumes input on a dedicated worker bounded at 64 objects. The reader loop never waits for the injection; the result is reported asynchronously. When the worker is full, pointer moves coalesce and the pressed set and release objects are kept. An object whose deadline has passed is dropped and counted, except release_all, pressed_set, and any object with the RELEASE flag, which are always applied.

  4. Pressed set. The receiver sends a pressed_set carrying the keys and buttons it holds, at resume and every clamp(2 x RTT, 5 s, 30 s). The sender keeps its own pressed set, and on every pressed_set it releases every key and button it believes pressed that the set does not contain. On a park, after key_release_grace = 2 s without the receiver, the sender releases everything for that receiver. On a session end, it releases everything through one release_all path.

  5. Deduplication. The sender rejects an (epoch, input_seq) it has already seen within the window. A reordered object is applied if it is newer than the last applied sequence and dropped otherwise. This makes the path effectively FIFO without requiring the transport to preserve order.

The pressed-set payload is u32 key_count || u32 keys... || u32 button_count || u32 buttons.... An empty set is the "release everything" heartbeat.

10. Timeouts and Timers

Every absolute constant on the path is a function of the measured round-trip time, clamped to a floor and a ceiling. The floor preserves the behaviour of a fast link; the ceiling prevents a broken estimator from hanging or spinning a session. Throughout this section, RTT is the smoothed round trip, RTT_min the window minimum, and J the jitter estimate.

Table 38: Protocol timers
Site Rule
Object assembly 3 x RTT + 500 ms
Report interval (idle) clamp(4 x RTT_min, 250 ms, 2 s)
Prompt report interval clamp(RTT_min / 4, 25 ms, 250 ms)
No-feedback grace 3 x report_interval + 2 s
Probe interval 1 s
Probe deadline 2 x RTT + 250 ms; none before the first RTT measurement
Idle object clamp(2 x RTT, 1000 ms, 3000 ms)
Input deadline 5000 ms by default; a deployment may set another value
Pressed-set heartbeat clamp(2 x RTT, 5 s, 30 s)
Key-release grace after park 2 s
Staleness budget 3 x (report_interval + 1 s)
Park TTL clamp(2 x outage_target + 60 s, 120 s, 900 s); 300 s by default
Resume token TTL Advertised in MediaHelloAck; 900 s by default
Reconnect base max(500 ms, RTT)
Reconnect ceiling 30 s
Reconnect jitter 0 to 250 ms
Write-queue residency 10 s; a media object older than this is dropped and counted
Acknowledgement ring max(64, ceil(2 x RTT / update_interval) + 8) updates

An implementation MUST assert the following arithmetic at start-up and in its tests:

A deployment that cannot satisfy these assertions has a session that will be torn down by a timeout rather than by a decision, which is the failure mode the framework exists to prevent.

11. Security Considerations

11.1. Threat Model

This section follows the guidance of [RFC3552]. MLP runs between a sender and one or more receivers over an untrusted network. Intermediaries may drop, reorder, duplicate, or delay fragments. Endpoints are authenticated by the carrier. MLP does not define a second authentication handshake, and it does not provide confidentiality or integrity of its own.

The carrier is therefore the trust boundary. A deployment MUST terminate TLS (or an equivalent authenticated, confidential transport) before a lane reaches MLP. A peer that cannot authenticate at the carrier has no MLP session. A deployment that needs receiver identity beyond the carrier's SHOULD require client certificates or an equivalent credential at the carrier.

11.2. Resume Tokens

A resume token is a bearer credential. It is not authentication: it is a proof that a previously authenticated carrier session may be continued. It grants nothing to a peer that did not hold the session, and it is validated in addition to the carrier's own authentication.

  • The token MUST be unforgeable and MUST be bound to the session, the receiver, and the sender.

  • It MUST carry a single-use generation that advances on every use, so a replay is detectable.

  • It MUST expire, and the expiry MUST be inside the authenticated payload, not beside it.

  • It MUST name the key that signed it. A validator MUST reject an unknown key, MUST accept more than one key during a rotation, and MUST keep the old key for at least one resume TTL after the new key starts issuing. Removing a key revokes every token it signed.

  • It MUST NOT be logged, placed in a URL, or sent to any party but the issuer.

A deployment that cannot protect or rotate its token keys MUST NOT issue resumable tokens. Every reconnect then starts a fresh session, which is degraded but never dead.

11.3. Replay and Injection

MLP's own identifiers make a replayed object detectable:

  • The object-id deduplication window rejects a repeated (object_id, fragment_index) pair.

  • The update-id window rejects an update that is older than the receiver's applied watermark, and the acknowledgement window reports exactly what was applied.

  • The chain epoch only moves forward; an object from an older epoch does not reset the receiver's trust.

  • The input sequence is deduplicated over a 4096-entry window keyed by (epoch, input_seq).

These checks are not a substitute for carrier integrity. An attacker who can inject a fragment inside an authenticated carrier can also inject a valid identifier sequence; the carrier's integrity is what prevents that attacker from existing.

11.4. Denial of Service

Every allocation has a stated bound. The important ones are:

Table 39: Resource bounds
Resource Bound
Open objects per lane 4
Bytes held by incomplete objects 1 MiB
Header extension 256 bytes
Fragments per object 4096
Fragment payload Carrier cap (65536 or 1150)
Parts per update 8 on a stream carrier; 4 on a datagram carrier; 1 under heavy loss
FEC group k and n at most 8
Sender write queue in_flight_cap objects and 4 MiB of payload
Receiver input queue 64 objects and 8 KiB
Coverage grid 2048 cells (a larger surface must be downscaled)

A receiver MUST bound the assembly state by its byte budget and its open-object count, not by the number of fragments that have arrived. A slot vector is bounded by the 4096-fragment wire maximum, and the payload is bounded by the 1 MiB assembly budget; a declaration of 4096 fragments must not reserve 4096 payload buffers before the fragments exist.

A sender MUST NOT emit an object above its own max_object_bytes. A receiver MUST reject an object above its configured maximum. The sender's cap prevents an object the link cannot carry; the receiver's cap prevents a peer from forcing an allocation.

The control lane MUST NOT carry a media fragment larger than 16 KiB. A hop that receives a larger media object on the control lane drops and counts it. This prevents a peer from bypassing the media lane's pacing and isolation.

11.5. Forward Error Correction Integrity

The FEC group's CRC-32 detects accidental corruption and proves a reconstruction; it is not a message authentication code. An attacker who can modify fragments can construct a group whose CRC is valid. The security guarantee against modification comes from the carrier, not from the parity. An implementation MUST NOT present a recovered part as authenticated merely because its CRC matched.

11.6. Congestion Control Safety

The estimator is not a general-purpose congestion controller and MUST NOT be used as one on a shared path. Section 4.7 states the requirement: a deployment runs MLP over a carrier with congestion control, or it provisions a hard ceiling. A probe is bounded to one fragment and one per probe interval; it is a measurement, not a sustained-rate override. The one-second window allowance of 1.25 times the pace is a burst allowance, and the long-run average MUST NOT exceed the pace.

11.7. Privacy Considerations

This section follows the guidance of [RFC6973]. MLP carries media bytes verbatim. Those bytes may contain personal data, and the carrier's confidentiality is what protects them. A deployment MUST encrypt the carrier.

  • MLP headers carry no user identifiers. SEND_EPOCH_MS and the other timestamps are session-relative, not wall-clock, and are not comparable across sessions.

  • The media session identifier and the object and update identifiers are opaque to the protocol and SHOULD be random or otherwise unlinkable across sessions.

  • app_version in MediaFeedback is a diagnostic string. It can fingerprint a client; a privacy-sensitive deployment SHOULD leave it empty or send a constant.

  • Traffic analysis can reveal interaction patterns through packet sizes and timing even when content is encrypted. A deployment that cares about this SHOULD pad or shape at the carrier, not at MLP; MLP's own pacing already avoids unnecessary bursts.

  • The input path can reveal keystrokes and pointer motion to every hop that forwards it. A deployment MUST authenticate and authorize every hop, and SHOULD encrypt end-to-end where its topology allows.

12. IANA Considerations

12.1. Media Type Registration

This document requests the registration of the following media type [RFC6838].

Table 40: Media type application/mlp-fragment
Type name application
Subtype name mlp-fragment
Required parameters None
Optional parameters None
Encoding considerations Binary. One body is one MLP fragment, beginning with the 22-byte fixed header. A stream carrier may concatenate several fragments in one transport message; the media type describes one fragment, not the concatenation.
Security considerations See Section 11 of this document.
Interoperability considerations See Section 4 of this document. A receiver that does not implement a class or a TLV skips it by length; the media type does not change.
Published specification This document.
Applications that use this media type Real-time interactive media transports, remote desktop, cloud gaming, and remote support.
Fragment identifier considerations None.
Additional information Magic number: 4d 4c 50 00 at offset 0. File extension: none. Macros: none. Uniform type identifier: none.
Person and email address to contact for further information Vitaly Kuzyaev <vitkuz573@gmail.com>
Intended usage COMMON
Restrictions on usage None.
Author Vitaly Kuzyaev
Change controller IETF

12.2. TLS ALPN Protocol ID

This document requests the registration of the following value in the "TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry [RFC7301].

Table 41: ALPN registration
Protocol Identification sequence Reference
Media Lane Protocol version 1 0x6d 0x6c 0x70 0x2d 0x76 0x31 (mlp-v1) This document

12.3. WebSocket Subprotocol Name

This document requests the registration of mlp-v1 in the "WebSocket Subprotocol Name Registry" [RFC6455], with this document as the reference.

12.4. New Registries

This document requests the creation of the registries below. Each registry is maintained by IANA. For each, the unassigned range uses the stated registration procedure [RFC8126], and the private-use range is reserved for private or experimental use without IANA registration.

12.4.1. MLP Fragment Classes

Table 42: MLP Fragment Classes
Value Name Reference
0 CONTROL This document
1 CURSOR This document
2 MEDIA This document
3 FEEDBACK This document
4 PATH This document
5-239 Unassigned Specification Required
240-255 Private Use This document

12.4.2. MLP Header Extension TLV Types

Table 43: Initial MLP Header Extension TLV Types assignments
Type Name Reference
0x00 Reserved This document
0x01 UPDATE_ID This document
0x02 UPDATE_BASE This document
0x03 PART This document
0x04 UPDATE_BYTES This document
0x05 CHAIN_EPOCH This document
0x06 REFLECTS_INPUT_SEQ This document
0x07 SEND_EPOCH_MS This document
0x08 DEADLINE_EPOCH_MS This document
0x09 ECHO_OF_OBJECT_ID This document
0x0A BUDGET_BYTES This document
0x0B PACE_BPS This document
0x0C PATH_HINT This document
0x0D INPUT_SEQ This document
0x0E CELL_COUNT This document
0x0F COST_MS This document
0x10 STREAM_ID This document
0x11 FEC_GROUP_ID This document
0x12 FEC_K This document
0x13 PATH_ID This document
0x14 FEC_N This document
0x15 FEC_REPAIR_INDEX This document
0x16-0xEF Unassigned Specification Required
0xF0-0xFF Experimental This document

12.4.3. MLP Priority Levels

Table 44: MLP Priority Levels
Value Use Reference
0 Control and acknowledgements This document
1 Input This document
2 Feedback reports and probe echoes This document
3 Hop reports This document
4 Unassigned Specification Required
5 Cursor This document
6 Interactive media This document
7 Background refresh This document

12.4.4. MLP Error Codes

Table 45: MLP Error Codes
Value Name Reference
0 Reserved This document
1 BAD_MAGIC This document
2 UNSUPPORTED_VERSION This document
3 BAD_CLASS This document
4 BAD_FLAGS This document
5 BAD_PRIORITY This document
6 BAD_FRAGMENT This document
7 BAD_LENGTH This document
8 BAD_EXT This document
9 META_MISMATCH This document
10 ASSEMBLY_TIMEOUT This document
11 ASSEMBLY_EVICTED This document
12 OBJECT_ID_WRAP This document
13 BODY_INVALID This document
14 RATE_LIMITED This document
15 LANE_DISABLED This document
16-239 Unassigned Specification Required
240-255 Private Use This document

12.4.5. MLP Lane States

Table 46: MLP Lane States
Value Name Reference
0 STARTING This document
1 LIVE This document
2 DEGRADED This document
3 CONVERGING This document
4 STALE This document
5 PARKED This document
6 DISABLED This document
7 DECODE_BOUND This document
8 NO_FEEDBACK This document
9 MEDIA_UNSUPPORTED This document
10-239 Unassigned Specification Required
240-255 Private Use This document

12.4.6. MLP Media Paths

Table 47: MLP Media Paths
Value Name Reference
0 unknown This document
1 stream This document
2 dc-direct This document
3 dc-turn This document
4 quic This document
5-239 Unassigned Specification Required
240-255 Private Use This document

12.4.7. MLP Input Kinds

Table 48: MLP Input Kinds
Value Name Reference
0 pointer_move This document
1 pointer_button This document
2 key This document
3 wheel This document
4 clipboard This document
5 release_all This document
6 pressed_set This document
7-239 Unassigned Specification Required
240-255 Private Use This document

12.4.8. MLP Close Codes

Table 49: MLP Close Codes
Value Name Reference
0 normal This document
1 server_shutdown This document
2 policy This document
3 superseded This document
4 park This document
5-239 Unassigned Specification Required
240-255 Private Use This document

12.4.9. MLP Resume Rejection Reasons

This registry holds UTF-8 strings, not integers. The initial values are:

Table 50: MLP Resume Rejection Reasons
Value Reference
ok This document
unknown_session This document
token_expired This document
token_invalid This document
peer_mismatch This document
epoch_stale This document
epoch_mismatch This document
park_evicted This document
All other strings Specification Required

12.5. Ports

MLP does not request a dedicated port. A deployment uses its carrier's port: the WebSocket or HTTPS port for a stream carrier, a QUIC port for QUIC, and the ICE-negotiated port for a WebRTC data channel.

13. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8126]
Cotton, M., Leiba, B., and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI 10.17487/RFC8126, , <https://www.rfc-editor.org/info/rfc8126>.
[RFC6838]
Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10.17487/RFC6838, , <https://www.rfc-editor.org/info/rfc6838>.
[RFC6455]
Fette, I. and A. Melnikov, "The WebSocket Protocol", RFC 6455, DOI 10.17487/RFC6455, , <https://www.rfc-editor.org/info/rfc6455>.
[RFC7301]
Friedl, S., Popov, A., Langley, A., and E. Stephan, "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, , <https://www.rfc-editor.org/info/rfc7301>.
[RFC8445]
Keranen, A., Holmberg, C., and J. Rosenberg, "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal", RFC 8445, DOI 10.17487/RFC8445, , <https://www.rfc-editor.org/info/rfc8445>.
[RFC8866]
Begen, A., Kyzivat, P., Perkins, C., and M. Handley, "SDP: Session Description Protocol", RFC 8866, DOI 10.17487/RFC8866, , <https://www.rfc-editor.org/info/rfc8866>.
[RFC8831]
Jesup, R., Loreto, S., and M. Tuxen, "WebRTC Data Channels", RFC 8831, DOI 10.17487/RFC8831, , <https://www.rfc-editor.org/info/rfc8831>.
[RFC8832]
Jesup, R., Loreto, S., and M. Tuxen, "WebRTC Data Channel Establishment Protocol", RFC 8832, DOI 10.17487/RFC8832, , <https://www.rfc-editor.org/info/rfc8832>.
[RFC9000]
Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed and Secure Transport", RFC 9000, DOI 10.17487/RFC9000, , <https://www.rfc-editor.org/info/rfc9000>.
[RFC9001]
Thomson, M. and S. Turner, "Using TLS to Secure QUIC", RFC 9001, DOI 10.17487/RFC9001, , <https://www.rfc-editor.org/info/rfc9001>.
[RFC3552]
Rescorla, E. and B. Korver, "Guidelines for Writing RFC Text on Security Considerations", BCP 72, RFC 3552, DOI 10.17487/RFC3552, , <https://www.rfc-editor.org/info/rfc3552>.
[RFC6973]
Cooper, A., Tschofenig, H., Aboba, B., Peterson, J., Morris, J., Hansen, M., and R. Smith, "Privacy Considerations for Internet Protocols", RFC 6973, DOI 10.17487/RFC6973, , <https://www.rfc-editor.org/info/rfc6973>.
[RFC2914]
Floyd, S., "Congestion Control Principles", BCP 41, RFC 2914, DOI 10.17487/RFC2914, , <https://www.rfc-editor.org/info/rfc2914>.
[RFC8085]
Eggert, L., Fairhurst, G., and G. Shepherd, "UDP Usage Guidelines", BCP 145, RFC 8085, DOI 10.17487/RFC8085, , <https://www.rfc-editor.org/info/rfc8085>.

14. Informative References

[RFC9002]
Iyengar, J. and I. Swett, "QUIC Loss Detection and Congestion Control", RFC 9002, DOI 10.17487/RFC9002, , <https://www.rfc-editor.org/info/rfc9002>.
[RFC9485]
Marx, R., Niccolini, L., Seemann, M., and L. Pardue, "qlog: Structured Logging for Network Protocols", RFC 9485, DOI 10.17487/RFC9485, , <https://www.rfc-editor.org/info/rfc9485>.
[RFC7942]
Sheffer, Y. and A. Farrel, "Improving Awareness of Running Code: The Implementation Status Section", RFC 7942, DOI 10.17487/RFC7942, , <https://www.rfc-editor.org/info/rfc7942>.
[RFC8827]
Rescorla, E., "WebRTC Security Architecture", RFC 8827, DOI 10.17487/RFC8827, , <https://www.rfc-editor.org/info/rfc8827>.

Appendix A. Test Vectors

The vectors below are the wire bytes of valid fragments. They are also committed, with the invalid vectors and the expected decisions, in the conformance corpus of the reference implementation. A conforming implementation MUST produce the same bytes for the same fields and MUST reach the same decision for the invalid inputs.

A.1. Minimal CONTROL Fragment

A CONTROL object with no extension and no payload. The fixed header is the whole fragment.

4d 4c 50 00 01 00 00 00 01 00 00 00 00 00 01 00
00 00 00 00 00 00
Table 51: Decoded minimal CONTROL fragment
Field Value
magic 4d 4c 50 00
version 1
class 0 (CONTROL)
flags 0x00
priority 0
object_id 1
fragment_index / count 0 / 1
payload_len 0
header_ext_len 0

A.2. MEDIA Anchor Fragment

A self-contained anchor update in one part and one fragment. The extension carries the update metadata; the payload is ten zero bytes.

4d 4c 50 00 01 02 02 06 04 00 00 00 00 00 01 00
0a 00 00 00 43 00 01 08 05 00 00 00 00 00 00 00
02 08 00 00 00 00 00 00 00 00 03 04 00 00 01 00
04 04 0a 00 00 00 05 04 01 00 00 00 06 08 00 00
00 00 00 00 00 00 10 04 00 00 00 00 13 01 00 07
08 f4 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
Table 52: Decoded MEDIA anchor fragment
Field or TLV Value
class / flags / priority 2 (MEDIA) / 0x02 (ANCHOR) / 6
object_id 4
fragment_index / count 0 / 1
payload_len 10
header_ext_len 67
UPDATE_ID 5
UPDATE_BASE 0 (self-contained)
PART index 0, count 1
UPDATE_BYTES 10
CHAIN_EPOCH 1
REFLECTS_INPUT_SEQ 0
STREAM_ID 0
PATH_ID 0
SEND_EPOCH_MS 500

A.3. MEDIA Update, First Fragment

The first fragment of a two-fragment object carrying part 1 of a four-part update. The object is incomplete without its second fragment; the vector illustrates the header and the update metadata.

4d 4c 50 00 01 02 00 06 2a 00 00 00 00 00 02 00
04 00 00 00 43 00 01 08 07 00 00 00 00 00 00 00
02 08 06 00 00 00 00 00 00 00 03 04 01 00 04 00
04 04 d2 04 00 00 05 04 03 00 00 00 06 08 63 00
00 00 00 00 00 00 10 04 00 00 00 00 13 01 00 07
08 e8 03 00 00 00 00 00 00 01 02 03 04
Table 53: Decoded first fragment
Field or TLV Value
class / flags / priority 2 (MEDIA) / 0x00 / 6
object_id 42
fragment_index / count 0 / 2
payload_len 4
header_ext_len 67
UPDATE_ID 7
UPDATE_BASE 6 (chained)
PART index 1, count 4
UPDATE_BYTES 1234
CHAIN_EPOCH 3
REFLECTS_INPUT_SEQ 99
STREAM_ID / PATH_ID 0 / 0
SEND_EPOCH_MS 1000
payload 01 02 03 04

A.4. Unknown TLV

A CONTROL fragment whose extension carries one unassigned type, 0x7f, with a four-byte value. A version 1 receiver skips it by length and accepts the fragment.

4d 4c 50 00 01 00 00 00 06 00 00 00 00 00 01 00
00 00 00 00 06 00 7f 04 ef be ad de

A.5. Parity Object

A parity object for a group of four parts with one repair row. Its payload is a Cauchy repair row (Section 8.7), not a content payload.

4d 4c 50 00 01 02 01 06 84 03 00 00 00 00 01 00
0e 00 00 00 46 00 02 08 00 00 00 00 00 00 00 00
04 04 00 00 00 00 05 04 00 00 00 00 06 08 00 00
00 00 00 00 00 00 07 08 00 00 00 00 00 00 00 00
0e 04 40 00 00 00 11 08 51 00 00 00 00 00 00 00
12 02 04 00 14 02 01 00 15 02 00 00 3a 00 30 5f
09 f9 47 b5 08 31 10 12 96 30
Table 54: Decoded parity object
Field or TLV Value
class / flags / priority 2 (MEDIA) / 0x01 (FIN) / 6
object_id 900
payload_len 14
header_ext_len 70
FEC_GROUP_ID 81
FEC_K 4
FEC_N 1
FEC_REPAIR_INDEX 0
CELL_COUNT 64

A.6. Input Object

A key object with sequence 1, deadline 5000 ms, no flags, and a two-byte payload (1e 00).

69 6e 70 75 74 01 00 00 00 00 00 00 00 88 13 00
00 00 00 00 00 02 00 02 00 1e 00
Table 55: Decoded input object
Field Value
marker input
input_seq 1
deadline_epoch_ms 5000
kind 2 (key)
flags 0x00
payload_len 2
payload 1e 00

A.7. Bare MediaAck

A priority-0 FEEDBACK body carrying a bare MediaAck: highest applied update 10, bitmap 0b10101 (updates 10, 8, and 6), epoch 3, 240 applied cells, converged, and input echo 99. The protobuf fields are 1, 2, 3, 4, 6, and 9.

08 0a 10 15 18 03 20 f0 01 30 01 48 63

A.8. FEC Coefficients

The Cauchy coefficients 1 / (r XOR (8 + j)) over GF(256) with polynomial 0x11D, for the first rows and columns:

Table 56: Cauchy coefficients
Row r j=0 j=1 j=2 j=3
0 0xAD 0x9D 0xDD 0x98
1 0x9D 0xAD 0x98 0xDD
2 0xDD 0x98 0xAD 0x9D

For example, fec_coefficient(1, 0) = 1/9 = 0x9D.

Appendix B. Protocol Buffers Schema

This appendix is the normative schema of the class bodies. The fragment header, the TLVs, and the media payload are not part of this schema. The schema is reproduced from the protocol's own mlp.proto; the field numbers are the wire field numbers used by Section 6.

syntax = "proto3";

package mlp.v1;


// The Media Lane Protocol (MLP) -- class bodies.
//
// The fragment header, the TLV registry and the object lifecycle
// are NOT
// protobuf: they are the byte-level MLP grammar defined by the
// specification
// and implemented by `mlp-rs` (`media::pdu`, `media::object`).
// This file
// defines only the *class-specific bodies* a peer may need to
// decode:
//
//  * `class = CONTROL` -> `MediaControlObject` (the oneof below);
//   * `class = FEEDBACK` -> a bare `MediaAck`, `MediaFeedback`,
//                           `MediaHopReport` or `ProbeEcho`;
//   * `class = CURSOR`   -> a bare `MediaCursor`;
//  * `class = MEDIA` -> opaque bytes. The protocol does not
// interpret
//                           them; a codec does.
//
// A hop that only forwards objects never needs the MEDIA body: it
// coalesces
// by the MLP header TLVs and replays the original fragment bytes.
//
// Field numbers and types are the specification's normative
// tables. A
// `MediaHopReport` and a `MediaProbe` are carried
// wire-identically by every
// hop, so a report stamped by one hop decodes with the type below
// and vice
// versa.

// `MediaCursor` (spec Section 6.2): unordered, latest-wins, never
// retransmitted.
// Validation: `shape_rgba.len() <= 8192`; the position is clamped
// by the
// receiver, never rejected (a cursor outside the surface is
// normal during a
// geometry change).
message MediaCursor {
  int32  x = 1;
  int32  y = 2;
  bool   visible = 3;
  // The receiver's local cursor shape generation; 0 = keep the
  // local shape.
  uint32 shape_seq = 4;
  // Sender-relative ms of the position sample.
  uint64 epoch_ms = 5;
  // Only when `shape_seq` changes from 0.
  uint32 hot_spot_x = 6;
  uint32 hot_spot_y = 7;
  // Optional, <= 8 KiB; a receiver that does not decode it keeps
  // its local
  // shape.
  bytes  shape_rgba = 8;
}

// `MediaAck` (spec Section 6.2): a selective bitmap over a
// 64-update window.
message MediaAck {
  // 0 = nothing applied yet.
  uint64 highest_applied_update_id = 1;
  // Bit i = applied update (highest - i), i in 0..64.
  uint64 ack_bitmap = 2;
  uint32 chain_epoch = 3;
  // The receiver's repair-cell grid size.
  uint32 applied_cell_count = 4;
  // The receiver's own count of cells it believes stale.
  uint32 stale_cells = 5;
  // The receiver's belief; the sender's accounting is
  // authoritative.
  bool   converged = 6;
  double render_latency_ms = 7;
  bool   has_render_latency_ms = 8;
  // The highest input_seq visible in the applied content.
  uint64 echo_of_input_seq = 9;
  // Sender-relative ms when this ack was produced.
  uint64 ack_epoch_ms = 10;
}

// `MediaFeedback` (spec Section 6.2): the receiver's only quality
// channel.
message MediaFeedback {
  // The receiver's measured RTT (clamped 1..60000).
  uint32 rtt_ms = 1;
  // The receiver's running minimum.
  uint32 rtt_min_ms = 2;
  uint32 jitter_ms = 3;
  // Payload bytes received since the previous report.
  uint64 received_bytes = 4;
  uint64 received_objects = 5;
  // Gaps in the update-id space since the previous report.
  uint64 lost_objects = 6;
  uint64 duplicated_objects = 7;
  uint64 reordered_objects = 8;
  // The interval these counters cover.
  uint64 window_ms = 9;
  MediaAck ack = 10;
  repeated ProbeEcho probes = 11;
  // The receiver's own outbound backlog (diagnostics).
  uint32 buffered_amount_bytes = 12;
  uint32 display_fps = 13;
  uint32 render_ms_p50 = 14;
  uint32 render_ms_p95 = 15;
  uint32 input_queue_depth = 16;
  uint64 input_submitted = 17;
  uint64 input_expired = 18;
  uint64 path_switches = 19;
  // MediaPath: 0=unknown, 1=ws, 2=dc-direct, 3=dc-turn, 4=quic.
  uint32 active_path = 20;
  // Diagnostics only; never parsed for behaviour.
  string app_version = 21;
  // The lane's measured loss shape over the report window (spec
  // Section 6.2.9):
  // loss bursts are runs of consecutive lost update ids. The
  // burst profile
  // is what the sender's parity policy is measured against (spec
  // Section 6.9).
  uint32 loss_bursts = 22;
  // Update ids lost this window, bursts included.
  uint32 lost_in_bursts = 23;
  // The window's longest burst; 0 when the window lost nothing.
  uint32 max_burst = 24;
  // The EWMA mean burst length (alpha = 1/8), x16 fixed point.
  uint32 mean_burst_ewma_x16 = 25;
}

// `ProbeEcho` (spec Section 6.2): the echo of a probe, correlated
// by object id.
message ProbeEcho {
  uint32 object_id = 1;
  uint64 send_epoch_ms = 2;
  uint64 echo_epoch_ms = 3;
  uint32 payload_bytes = 4;
}

// `MediaHopReport` (spec Section 6.2): what an intermediary hop
// dropped.
// `hop`: 1=first intermediary, 2=edge (extensible: 3=dc, 4=turn).
message MediaHopReport {
  uint32 hop = 1;
  uint64 objects_dropped = 2;
  uint64 bytes_dropped = 3;
  uint64 coalesced = 4;
  uint32 queue_depth_peak = 5;
  uint32 queue_depth_current = 6;
  uint32 window_ms = 7;
  // The hop's own RTT to the next hop, when it measures one.
  uint32 rtt_ms_own = 8;
  // Total ms this hop's writer waited on capacity.
  uint32 backpressure_ms = 9;
}

// `MediaProbe` (spec Section 6.2): a path probe; never carries
// payload.
message MediaProbe {
  uint32 probe_id = 1;
  uint32 payload_bytes = 2;
  uint64 send_epoch_ms = 3;
}

// `MediaControlObject` (spec Section 6.3): the CONTROL-class
// oneof wrapper.
message MediaControlObject {
  oneof body {
    MediaHello       hello = 1;
    MediaHelloAck    hello_ack = 2;
    MediaResume      resume = 3;
    MediaResumeAck   resume_ack = 4;
    MediaLaneState   lane_state = 5;
    MediaClose       close = 7;
    MediaError       error = 8;
    MediaPathChange  path_change = 9;
    MediaDatagramSignal datagram_signal = 10;
  }
  reserved 6;
}

// `MediaHello` (spec Section 6.3): the first object a media lane
// sends.
message MediaHello {
  // 1.
  uint32 protocol_version = 1;
  // "" for a fresh session; non-empty only in a resume.
  string media_session_id = 2;
  // The control-lane session id.
  string session_id = 3;
  // The sender's cap (1150 on a datagram carrier, 65536 on a
  // stream carrier).
  uint32 max_fragment_payload = 4;
  // The sender's repair-cell grid.
  uint32 cell_size = 5;
  uint32 cell_cols = 6;
  uint32 cell_rows = 7;
  // "anchor","datagram","hop_report","probe","cursor","dupe".
  repeated string capabilities = 8;
  uint32 encoder_max_fps = 9;
  uint64 start_epoch_ms = 10;
}

// `MediaHelloAck` (spec Section 6.3).
message MediaHelloAck {
  uint32 protocol_version = 1;
  // Assigned here for a fresh session.
  string media_session_id = 2;
  // min(sender, receiver).
  uint32 accepted_fragment_payload = 3;
  uint32 cell_size = 4;
  uint32 cell_cols = 5;
  uint32 cell_rows = 6;
  repeated string capabilities = 7;
  uint32 resume_ttl_seconds = 8;
  // false => the lane degrades; the UI shows its unsupported
  // state.
  bool   media_supported = 9;
  // Typed: "protocol", "disabled_by_policy",
  // "no_sender_capability".
  string media_unsupported_reason = 10;
}

// `MediaResume` (spec Section 6.3): what the receiver held when
// the lane died.
message MediaResume {
  // Opaque; never parsed by the browser.
  string resume_token = 1;
  uint64 applied_update_id = 2;
  uint32 chain_epoch = 3;
  uint64 ack_bitmap = 4;
  // The receiver's next input seq (dedup boundary).
  uint64 input_seq_next = 5;
  repeated uint32 pressed_keys = 6;
  repeated uint32 pressed_buttons = 7;
  uint32 active_path = 8;
  // A fresh negotiation id if the receiver renegotiated.
  string dc_transport_id = 9;
}

// `MediaResumeAck` (spec Section 6.3).
message MediaResumeAck {
  bool   accepted = 1;
  // "ok", "unknown_session", "token_expired", "token_invalid",
  // "peer_mismatch",
  // "epoch_stale","epoch_mismatch","park_evicted".
  string reason = 2;
  // The update id the sender will use next for this receiver.
  uint64 next_update_id = 3;
  // Cells the sender will re-send (diagnostics; anchor updates
  // follow).
  uint64 pending_cells = 4;
  uint32 pace_bps = 5;
  uint32 budget_bytes = 6;
  uint32 target_fps = 7;
  reserved 8;
}

// `MediaLaneState` (spec Section 6.3).
// state: 0=STARTING, 1=LIVE, 2=DEGRADED, 3=CONVERGING, 4=STALE,
// 5=PARKED,
//  6=DISABLED, 7=DECODE_BOUND, 8=NO_FEEDBACK,
// 9=MEDIA_UNSUPPORTED.
message MediaLaneState {
  uint32 state = 1;
  uint64 since_epoch_ms = 2;
  string detail = 3;
}

// `MediaClose` (spec Section 6.3).
// code: 0=normal, 1=server_shutdown, 2=policy, 3=superseded,
// 4=park.
message MediaClose {
  uint32 code = 1;
  string reason = 2;
  // true is the "come back" signal of the session-continuity
  // rules.
  bool park = 3;
}

// `MediaError` (spec Section 6.3).
// code: 1=BAD_MAGIC, 2=UNSUPPORTED_VERSION, 3=BAD_CLASS,
// 4=BAD_FLAGS,
//       5=BAD_PRIORITY, 6=BAD_FRAGMENT, 7=BAD_LENGTH, 8=BAD_EXT,
//  9=META_MISMATCH, 10=ASSEMBLY_TIMEOUT, 11=ASSEMBLY_EVICTED,
//  12=OBJECT_ID_WRAP, 13=BODY_INVALID, 14=RATE_LIMITED,
// 15=LANE_DISABLED.
message MediaError {
  uint32 code = 1;
  uint32 object_id = 2;
  string detail = 3;
}

// `MediaDatagramSignal` (spec Section 6.8.1): the S2 data-channel
// setup, carried
// on the control lane. The sender is the offerer; the receiver
// answers.
message MediaDatagramSignal {
  oneof body {
    MediaDatagramOffer     offer = 1;
    MediaDatagramAnswer    answer = 2;
    MediaDatagramCandidate candidate = 3;
    MediaDatagramClose     close = 4;
  }
}

message MediaDatagramOffer {
  // The SDP offer, verbatim.
  string sdp = 1;
}

message MediaDatagramAnswer {
  // The SDP answer, verbatim.
  string sdp = 1;
}

message MediaDatagramCandidate {
  // The candidate line, verbatim.
  string candidate = 1;
  string sdp_mid = 2;
  uint32 sdp_mline_index = 3;
}

message MediaDatagramClose {
  // "closed","failed","ice_failed","dtls_failed".
  string reason = 1;
}

// `MediaPathChange` (spec Section 6.3, Section 7.8).
// from_path/to_path: 0=unknown, 1=ws, 2=dc-direct, 3=dc-turn,
// 4=quic.
message MediaPathChange {
  uint32 from_path = 1;
  uint32 to_path = 2;
  string reason = 3;
  uint64 at_epoch_ms = 4;
}

Appendix C. State Machines

The state machines below are the observable states a conforming implementation exposes. An implementation may keep more internal state; the transitions that matter to a peer are these.

C.1. Session

IDLE -> HANDSHAKING -> ACTIVE -> PARKED -> RESUMING -> ACTIVE
ACTIVE -> CLOSING -> CLOSED
Table 57: Session transitions
From Event To
IDLE Handshake complete ACTIVE
ACTIVE Park request PARKED
PARKED Resume request RESUMING
RESUMING Resume accepted ACTIVE
RESUMING Resume refused PARKED
ACTIVE Close request CLOSING
CLOSING Close acknowledged CLOSED
Any Fatal error CLOSED

C.2. Sender

READY -> ENQUEUING -> PACING -> SENDING -> AWAITING_ACK -> READY
Table 58: Sender transitions
From Event To
READY Update enqueued ENQUEUING
ENQUEUING Object admitted PACING
PACING Pacer grants tokens SENDING
SENDING Fragment emitted SENDING or AWAITING_ACK
AWAITING_ACK Acknowledgement applied READY
AWAITING_ACK Ack timeout SENDING (new whole state)
SENDING State applied READY

C.3. Receiver

WAITING -> ASSEMBLING -> APPLYING -> ACKING -> WAITING
Table 59: Receiver transitions
From Event To
WAITING First fragment of an object ASSEMBLING
ASSEMBLING Object complete APPLYING
ASSEMBLING Assembly timeout or eviction WAITING
APPLYING Update applied atomically ACKING
ACKING Ack emitted WAITING

Appendix D. Design Rationale

This appendix records the choices a reader is most likely to question. It is informative.

Why whole updates rather than per-cell repair:

A per-cell repair ladder requires the transport to know what a cell contains and to re-encode it, which couples the transport to a codec. MLP instead carries whole updates and lets the content layer re-encode the current state. The sender's cell accounting tells the content layer what to cover; the transport only does set arithmetic.

Why two lanes:

A large media object on the control connection head-of-line blocks the acknowledgements and input that keep the session alive. Separating the lanes makes the isolation structural rather than a priority argument. When a deployment must share one connection, the priority and reserved-rate rules still apply; only head-of-line isolation is lost.

Why anchors rather than resets:

A reset is full coverage by definition. On a 32 kbps link no budget makes a full reset timely, and it is the one object that can discard a receiver's whole progress. An anchor update re-sends the cells the receiver is missing at the current rate, and every band is an improvement rather than a wager.

Why loss is counted in the update-id space:

The object-id space is per sender, and a lane carries objects from several senders. A gap in it can be an intermediary's own object arriving, not a lost update. The update-id space is the media sender's own, so a gap there means exactly one thing: the receiver never saw that update.

Why the input path never echoes keys:

An echoed character the sender never received is a data-integrity lie, and the input path is where a lie does the most damage. The pointer overlay is indicative because the sender composites the pointer into the content; keys have no such reconciliation.

Why version 1 has no negotiation:

A version negotiation is itself a protocol that must be specified, tested, and kept stable across every future version. For a first version, a typed refusal is simpler and safer than a negotiation that can silently pick a grammar the peer does not fully implement. A future version can add negotiation if the deployment experience justifies it.

Appendix E. Implementation Status

This appendix follows the guidance of [RFC7942]. It is informative and does not change the specification.

At the time of writing, the protocol has:

The implementations interoperate over WebSocket and QUIC streams. The WebRTC data-channel carrier is exercised by the conformance suite's datagram scenarios. The conformance corpus is the authority on which capabilities each implementation covers; a capability without a case is not claimed.

The source repositories are at https://gitlab.com/medialaneprotocol. The specification, the schema, and the corpus are the three normative artifacts; an implementation that disagrees with any of them is a bug in one of them.

Author's Address

Vitaly Kuzyaev
Independent