<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp "&#160;">
  <!ENTITY mdash "&#8212;">
  <!ENTITY times "&#215;">
  <!ENTITY alpha "&#945;">
  <!ENTITY plusmn "&#177;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     version="3"
     ipr="trust200902"
     docName="draft-kuzyaev-medialane-01"
     category="info"
     submissionType="IETF"
     consensus="false"
     xml:lang="en">
  <front>
    <title abbrev="MLP">Media Lane Protocol (MLP) Version 1</title>
    <seriesInfo name="Internet-Draft" value="draft-kuzyaev-medialane-01"/>
    <author initials="V." surname="Kuzyaev" fullname="Vitaly Kuzyaev">
      <organization>Independent</organization>
      <address>
        <email>vitkuz573@gmail.com</email>
      </address>
    </author>
    <date year="2026" month="December" day="1"/>
    <area>Transport</area>
    <abstract>
      <t>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.</t>
    </abstract>
    <note>
      <name>Discussion</name>
      <t>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.</t>
    </note>
  </front>
  <middle>
    <section anchor="intro" numbered="true">
      <name>Introduction</name>

      <section anchor="problem">
        <name>Problem Statement</name>
        <t>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.</t>
        <t>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.</t>
      </section>

      <section anchor="goals">
        <name>Design Goals</name>
        <ol>
          <li><t><strong>Atomic delivery.</strong> A receiver applies an
          update whole or not at all. A partial update is never
          presented.</t></li>
          <li><t><strong>Bounded state.</strong> Every queue, table, and
          decoding buffer has a stated bound. No peer can make another peer
          allocate without limit.</t></li>
          <li><t><strong>Honest accounting.</strong> A sender knows which
          updates each receiver has applied, and a receiver's convergence is
          a predicate over that set rather than an impression.</t></li>
          <li><t><strong>Measured pacing.</strong> 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.</t></li>
          <li><t><strong>Content neutrality.</strong> The protocol moves
          opaque bytes. It does not parse a codec's payload, and a new codec
          requires no change to the transport.</t></li>
          <li><t><strong>Carrier independence.</strong> The same fragment
          grammar runs over a reliable, ordered stream and over an unreliable,
          unordered datagram carrier.</t></li>
          <li><t><strong>Sans-IO.</strong> 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.</t></li>
        </ol>
      </section>

      <section anchor="non-goals">
        <name>Non-Goals</name>
        <t>MLP deliberately does not define:</t>
        <ul>
          <li><t>the meaning, encoding, or quality of media content, which is
          a codec's concern;</t></li>
          <li><t>user authentication, authorization, or identity; a session
          exists only inside a carrier that has already authenticated
          it;</t></li>
          <li><t>encryption or integrity protection; the carrier provides
          both;</t></li>
          <li><t>signaling, session discovery, or NAT traversal, except for
          the datagram-carrier exchange carried inside an established
          session;</t></li>
          <li><t>a deployment's topology, endpoints, supervision, or
          persistence;</t></li>
          <li><t>audio, which is not carried by this version;</t></li>
          <li><t>multipath delivery, stream multiplexing, and 0-RTT
          resumption, which are not part of version 1.</t></li>
        </ul>
      </section>

      <section anchor="relationship">
        <name>Relationship to Other Protocols</name>
        <t>MLP is complementary to, not a replacement for, the protocols
        below it and beside it.</t>
        <dl>
          <dt>QUIC and TCP:</dt>
          <dd><t>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.</t></dd>
          <dt>WebRTC data channels:</dt>
          <dd><t>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.</t></dd>
          <dt>RTP and WebRTC media:</dt>
          <dd><t>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.</t></dd>
          <dt>Protobuf:</dt>
          <dd><t>The class bodies are encoded with a restricted Protocol
          Buffers wire format. The framing, the TLVs, and the media payload
          are not protobuf.</t></dd>
        </dl>
      </section>

      <section anchor="organization">
        <name>Document Organization</name>
        <t>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.</t>
      </section>
    </section>

    <section anchor="conventions">
      <name>Conventions and Terminology</name>

      <section anchor="keywords">
        <name>Requirements Language</name>
        <t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;,
        &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,
        &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,
        &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot;
        in this document are to be interpreted as described in BCP 14
        <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>
      </section>

      <section anchor="terminology">
        <name>Terminology</name>
        <dl>
          <dt>Session:</dt>
          <dd><t>The association between one sender and one receiver,
          identified by a media session identifier. A session survives a
          carrier failure by parking and resuming.</t></dd>
          <dt>Lane:</dt>
          <dd><t>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.</t></dd>
          <dt>Sender:</dt>
          <dd><t>The peer that produces media updates and accounts for what
          each receiver holds.</t></dd>
          <dt>Receiver:</dt>
          <dd><t>The peer that applies updates and acknowledges them.</t></dd>
          <dt>Intermediary:</dt>
          <dd><t>A peer that forwards whole objects between a sender and a
          receiver without interpreting their content.</t></dd>
          <dt>Carrier:</dt>
          <dd><t>The transport over which fragments travel. A
          <em>stream carrier</em> is reliable and ordered. A <em>datagram
          carrier</em> may lose, duplicate, and reorder.</t></dd>
          <dt>Fragment:</dt>
          <dd><t>The unit of MLP framing: a fixed header, an optional header
          extension, and a class-specific body.</t></dd>
          <dt>Object:</dt>
          <dd><t>A unit of framing consisting of one or more fragments. An
          object is reassembled before it is delivered.</t></dd>
          <dt>Update:</dt>
          <dd><t>The protocol's unit of media state. An update consists of one
          or more parts; each part is carried as one object.</t></dd>
          <dt>Part:</dt>
          <dd><t>One contiguous piece of an update, carried as exactly one
          object. A single-part update is one object.</t></dd>
          <dt>Cell:</dt>
          <dd><t>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.</t></dd>
          <dt>Chain epoch:</dt>
          <dd><t>A sender-owned counter that advances when the sender breaks
          the update chain. A receiver adopts a greater epoch and never a
          smaller one.</t></dd>
          <dt>Convergence:</dt>
          <dd><t>The state in which a receiver's pending set is empty and the
          last update it applied is the last update the sender
          emitted.</t></dd>
          <dt>Parking:</dt>
          <dd><t>The deliberate retention of a session's state after its
          carrier fails, so that a returning peer can resume it.</t></dd>
          <dt>Sans-IO:</dt>
          <dd><t>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.</t></dd>
        </dl>
      </section>

      <section anchor="notation">
        <name>Byte Order and Notation</name>
        <t>All multi-byte integers on the wire are little-endian. Offsets are
        zero-based from the first byte of the fragment. The notation
        <tt>u8</tt>, <tt>u16</tt>, <tt>u32</tt>, <tt>u64</tt>, <tt>i32</tt>,
        and <tt>f64</tt> 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 <tt>4d 4c 50 00</tt>.</t>
        <t>An <em>RTT</em> is the sender's smoothed round-trip time in
        milliseconds; <em>RTT_min</em> is the minimum over the estimator's
        sliding horizon; <em>J</em> is the jitter estimate. A formula such as
        <tt>clamp(4 x RTT_min, 250 ms, 2 s)</tt> means the value is
        clamped to the closed interval.</t>
      </section>

      <section anchor="time">
        <name>Session-Relative Time</name>
        <t>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 &quot;no deadline&quot;.</t>
      </section>

      <section anchor="roles">
        <name>Roles</name>
        <t>The three roles are named by what they do, not by where they are
        deployed. One process may perform more than one role.</t>
        <table>
          <name>Protocol roles</name>
          <thead>
            <tr><th>Role</th><th>Does</th><th>Never</th></tr>
          </thead>
          <tbody>
            <tr>
              <td>Sender</td>
              <td>Produces updates, measures the link, paces output, and
              accounts for each receiver's applied window.</td>
              <td>Interprets a receiver's content.</td>
            </tr>
            <tr>
              <td>Receiver</td>
              <td>Applies updates atomically, acknowledges what it applied,
              and reports the link it measures.</td>
              <td>Decides what the sender should send next.</td>
            </tr>
            <tr>
              <td>Intermediary</td>
              <td>Forwards whole objects, preserves unknown header
              extensions, and reports what it dropped.</td>
              <td>Decodes or rewrites an object's content.</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>

    <section anchor="architecture">
      <name>Architecture</name>

      <section anchor="traffic-classes">
        <name>Lanes and Traffic Classes</name>
        <t>A session carries five traffic classes. The class a fragment
        belongs to is fixed by the header's <tt>class</tt> field, except that
        control-lane classes share the <tt>CONTROL</tt> class and are
        distinguished by their body.</t>
        <table>
          <name>Traffic classes</name>
          <thead>
            <tr><th>Class</th><th>Name</th><th>Objects</th><th>Semantics</th><th>Priority</th></tr>
          </thead>
          <tbody>
            <tr>
              <td>C0</td><td>Control and lifecycle</td>
              <td>Handshake, resume, lane state, errors, close</td>
              <td>Reliable, ordered, urgent</td><td>0</td>
            </tr>
            <tr>
              <td>C1</td><td>Input</td>
              <td>Pointer, key, wheel, clipboard, pressed set</td>
              <td>Reliable, ordered, deadline-bounded, deduplicated</td><td>1</td>
            </tr>
            <tr>
              <td>C2</td><td>Cursor</td>
              <td>Pointer position and shape</td>
              <td>Unreliable, latest-wins, never retransmitted</td><td>5</td>
            </tr>
            <tr>
              <td>C3</td><td>Media</td>
              <td>Media updates; parity objects</td>
              <td>Atomic objects, repair by a later whole state</td>
              <td>6 interactive, 7 background</td>
            </tr>
            <tr>
              <td>C4</td><td>Feedback</td>
              <td>Acknowledgements, reports, hop reports, probe echoes</td>
              <td>Acknowledgements are priority 0; reports priority 2</td>
              <td>0 or 2</td>
            </tr>
          </tbody>
        </table>
        <t>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.</t>
      </section>

      <section anchor="isolation">
        <name>Isolation Rules</name>
        <t>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.</t>
        <ol>
          <li><t><strong>Logical separation.</strong> 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.</t></li>
          <li><t><strong>Strict priority.</strong> A writer drains objects in
          this order: C0, C1, C2, C4 (acknowledgements and reports), C3
          priority 6, C3 priority 7. The header's <tt>priority</tt> 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.</t></li>
          <li><t><strong>Reserved rate.</strong> The media pacer reserves
          <tt>max(2 kbps, 10% x pace)</tt> for non-media traffic. A
          media object MUST NOT be released if doing so would leave less than
          <tt>max(1 x RTT, 250 ms)</tt> of that reserve.
          Non-media classes MAY borrow media tokens; media MUST NOT borrow
          the reserve.</t></li>
          <li><t><strong>Bounded in-flight.</strong> A sender starts with at
          most two media objects awaiting the carrier per receiver and earns
          up to its configured <tt>in_flight_cap</tt> 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
          <tt>in_flight_cap x max_object_bytes</tt> beyond what the
          carrier has accepted.</t></li>
          <li><t><strong>Whole-object coalescing.</strong> 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.</t></li>
          <li><t><strong>Input is never coalesced for capacity.</strong> 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.</t></li>
        </ol>
      </section>

      <section anchor="sans-io">
        <name>Protocol Layers and the Sans-IO Boundary</name>
        <t>An implementation is a set of deterministic state machines. Time
        enters as an <tt>Instant</tt> parameter; outbound data leaves as
        <tt>Action</tt> 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.</t>
        <t>Three loops run inside a sender:</t>
        <ul>
          <li><t>the <strong>content loop</strong>, which turns a change in
          the content into one or more updates;</t></li>
          <li><t>the <strong>delivery loop</strong>, which tracks what each
          receiver has applied and what it may be missing;</t></li>
          <li><t>the <strong>capacity loop</strong>, which measures the link
          and sets the pace and the per-update budget.</t></li>
        </ul>
      </section>

      <section anchor="state">
        <name>Protocol State</name>
        <t>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.</t>
        <t>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.</t>
        <t>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.</t>
      </section>

      <section anchor="carrier-abstraction">
        <name>Carrier Abstraction</name>
        <t>MLP defines two carrier classes and does not require a particular
        transport protocol.</t>
        <dl>
          <dt>Stream carrier:</dt>
          <dd><t>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.</t></dd>
          <dt>Datagram carrier:</dt>
          <dd><t>May lose, duplicate, and reorder. One transport message
          contains exactly one fragment, and that fragment's
          <tt>fragment_count</tt> MUST be 1. WebRTC data channels are the
          datagram carrier defined by this document.</t></dd>
        </dl>
        <t>The fragment byte layout is identical on both. Only the message
        boundary and the reliability assumptions differ.</t>
      </section>
    </section>
    <section anchor="carriers">
      <name>Carriers</name>

      <section anchor="carrier-requirements">
        <name>Carrier Requirements</name>
        <t>A carrier used by MLP MUST provide:</t>
        <ul>
          <li><t>message boundaries, so that one transport message carries a
          whole fragment or a whole run of concatenated fragments;</t></li>
          <li><t>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;</t></li>
          <li><t>a stated maximum message size and a stated reliability
          model.</t></li>
        </ul>
        <t>A carrier that cannot provide integrity and confidentiality MUST
        NOT carry an MLP session. Section 11 states the consequences.</t>
        <table>
          <name>Carrier classes and payload caps</name>
          <thead>
            <tr>
              <th>Carrier</th>
              <th>Class</th>
              <th>Fragments per message</th>
              <th>Fragment payload cap</th>
              <th>Defined in</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>WebSocket</td><td>Stream</td><td>Exactly 1</td>
              <td>65536 bytes</td><td>Section 4.2</td>
            </tr>
            <tr>
              <td>QUIC stream</td><td>Stream</td><td>1 to N, concatenated</td>
              <td>65536 bytes</td><td>Section 4.3</td>
            </tr>
            <tr>
              <td>gRPC message</td><td>Stream</td><td>1 to N, concatenated</td>
              <td>65536 bytes</td><td>Section 4.4</td>
            </tr>
            <tr>
              <td>WebRTC data channel</td><td>Datagram</td><td>Exactly 1</td>
              <td>1150 bytes</td><td>Section 4.5</td>
            </tr>
          </tbody>
        </table>
        <t>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
        <tt>22 + 256 + payload_cap</tt> bytes for a single maximum-size
        fragment. A receiver MUST reject a fragment whose <tt>payload_len</tt>
        exceeds its carrier's payload cap with <tt>BAD_LENGTH</tt>, and MUST
        reject a datagram-carrier message that carries more than one fragment
        or a fragment whose <tt>fragment_count</tt> is not 1 with
        <tt>BAD_FRAGMENT</tt>.</t>
        <t>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 <tt>BAD_LENGTH</tt>; the receiver does not
        deliver the fragments that preceded the error.</t>
      </section>

      <section anchor="websocket">
        <name>WebSocket</name>
        <t>A media lane over WebSocket uses the WebSocket subprotocol name
        <tt>mlp-v1</tt> <xref target="RFC6455"/>. The connection MUST be
        secured with TLS (a <tt>wss</tt> URI). One WebSocket binary message
        carries exactly one fragment.</t>
        <t>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 <tt>MediaHello</tt>.</t>
        <t>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.</t>
        <table>
          <name>WebSocket close codes</name>
          <thead>
            <tr><th>Code</th><th>Meaning</th></tr>
          </thead>
          <tbody>
            <tr><td>1000</td><td>Normal closure.</td></tr>
            <tr><td>4400</td><td>The message did not parse as a valid fragment.</td></tr>
            <tr><td>4401</td><td>The carrier has not authenticated the peer.</td></tr>
            <tr><td>4403</td><td>The peer is authenticated but not authorized for this session.</td></tr>
            <tr><td>4404</td><td>No such session, or the session has ended.</td></tr>
            <tr><td>4409</td><td>Another connection already owns the session.</td></tr>
            <tr><td>4410</td><td>The park TTL expired; the session cannot be resumed.</td></tr>
            <tr><td>4413</td><td>An object exceeded the negotiated limit.</td></tr>
            <tr><td>4415</td><td>The peer does not speak this media protocol version.</td></tr>
          </tbody>
        </table>
        <t>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.</t>
      </section>

      <section anchor="quic">
        <name>QUIC Streams</name>
        <t>A media lane over QUIC uses ALPN <tt>mlp-v1</tt>
        <xref target="RFC9000"/> <xref target="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.</t>
        <t>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 <tt>70 s</tt> and a keep-alive interval of
        at most <tt>10 s</tt> satisfy the arithmetic of Section 10 for a
        30-second outage at a 2-second round trip.</t>
        <t>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.</t>
      </section>

      <section anchor="grpc">
        <name>gRPC Messages</name>
        <t>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.</t>
        <t>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.</t>
      </section>

      <section anchor="datagram">
        <name>WebRTC Data Channels</name>
        <t>The datagram carrier is a pair of WebRTC data channels,
        <tt>mlp.media</tt> and <tt>mlp.repair</tt>, negotiated with SCTP over
        DTLS over ICE <xref target="RFC8831"/> <xref target="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.</t>
        <t>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.</t>

        <section anchor="datagram-establishment">
          <name>Establishing the Datagram Carrier</name>
          <t>The sender is the offerer. It creates the peer connection and
          both data channels, then sends a <tt>MediaDatagramSignal</tt> 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.</t>
          <t>The exchange is authenticated by the control lane's carrier, and the WebRTC
          security architecture <xref target="RFC8827"/> applies to it. MLP
          does not define a second authentication or a second handshake. A
          peer that can carry the datagram carrier lists <tt>datagram</tt> in
          its <tt>MediaHello</tt> or <tt>MediaHelloAck</tt> capabilities. A
          data-channel close, an ICE failure, or a DTLS failure demotes the
          session at once, and the stream carrier resumes the media.</t>
        </section>
      </section>

      <section anchor="carrier-selection">
        <name>Carrier Selection</name>
        <t>A receiver MAY be served over a datagram carrier when one is
        available. Promotion to the datagram carrier requires all of:</t>
        <ul>
          <li><t>the carrier's connection is established;</t></li>
          <li><t>the media channel is open;</t></li>
          <li><t>a probe window of <tt>2 x RTT_min</tt> has passed with
          a delivered ratio of at least 0.5.</t></li>
        </ul>
        <t>Promotion happens when the datagram carrier's goodput is at least
        1.2 times the stream carrier's, sustained for
        <tt>3 x RTT_min</tt>. Demotion happens when the datagram
        carrier's goodput falls below 0.8 times the stream carrier's for
        <tt>3 x RTT_min</tt>, when the channel closes, or when a probe
        window shows a delivered ratio below 0.2.</t>
        <t>A switch costs one round trip. Both carriers stay open during the
        switch, the lane announces <tt>MediaPathChange</tt>, 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.</t>
      </section>

      <section anchor="carrier-cc">
        <name>Relationship to Carrier Congestion Control</name>
        <t>MLP's capacity estimator and pacer are an application-layer
        adaptation layer. The congestion-control principles of
        <xref target="RFC2914"/> and the UDP guidance of
        <xref target="RFC8085"/> apply; a datagram deployment that uses
        QUIC&#39;s loss detection and congestion control follows
        <xref target="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.</t>
        <ul>
          <li><t>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.</t></li>
          <li><t>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.</t></li>
          <li><t>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.</t></li>
          <li><t>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.</t></li>
          <li><t>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.</t></li>
        </ul>
      </section>
    </section>
    <section anchor="wire">
      <name>Wire Format</name>
      <t>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.</t>

      <section anchor="header">
        <name>Fragment Header</name>
        <t>Every fragment begins with a fixed 22-byte header. All multi-byte
        fields are little-endian. Offsets are from the first byte of the
        fragment.</t>
        <!-- BEGIN HEADER FIELDS -->
        <table>
          <name>Fragment header fields</name>
        <thead>
          <tr><th>Offset</th><th>Size</th><th>Field</th><th>Description</th></tr>
        </thead>
        <tbody>
          <tr><td>0</td><td>4</td><td><tt>magic</tt></td><td>The four bytes 4D 4C 50 00. Any other prefix rejects the transport message with BAD_MAGIC.</td></tr>
          <tr><td>4</td><td>1</td><td><tt>version</tt></td><td>The protocol version. Any other value rejects the object with UNSUPPORTED_VERSION.</td></tr>
          <tr><td>5</td><td>1</td><td><tt>class</tt></td><td>0 CONTROL, 1 CURSOR, 2 MEDIA, 3 FEEDBACK, 4 PATH; 5..255 is BAD_CLASS.</td></tr>
          <tr><td>6</td><td>1</td><td><tt>flags</tt></td><td>Bit field. Bit 7 must be zero; any other value is BAD_FLAGS.</td></tr>
          <tr><td>7</td><td>1</td><td><tt>priority</tt></td><td>0..7 with 0 highest. MEDIA may not use 0 or 1.</td></tr>
          <tr><td>8</td><td>4</td><td><tt>object_id</tt></td><td>Monotone per lane, direction and sender epoch; zero is reserved.</td></tr>
          <tr><td>12</td><td>2</td><td><tt>fragment_index</tt></td><td>0..fragment_count-1; anything else is BAD_FRAGMENT.</td></tr>
          <tr><td>14</td><td>2</td><td><tt>fragment_count</tt></td><td>1..4096; anything else is BAD_FRAGMENT.</td></tr>
          <tr><td>16</td><td>4</td><td><tt>payload_len</tt></td><td>The class body length, at most the carrier payload cap.</td></tr>
          <tr><td>20</td><td>2</td><td><tt>header_ext_len</tt></td><td>0 or 2..256 and the bytes must parse as whole TLVs.</td></tr>
        </tbody>
        </table>
      <!-- END HEADER FIELDS -->
        <t>The fixed header is 22 bytes. The header extension, when present,
        follows immediately, and the class body follows the extension.</t>
      </section>

      <section anchor="flags">
        <name>Flags</name>
        <t>Bit 7 of the <tt>flags</tt> byte is reserved and MUST be zero. A
        fragment with bit 7 set is rejected with <tt>BAD_FLAGS</tt>.</t>
        <!-- BEGIN FLAGS -->
        <table>
          <name>Fragment flags</name>
        <thead>
          <tr><th>Bit</th><th>Name</th><th>Description</th></tr>
        </thead>
        <tbody>
          <tr><td>0</td><td><tt>FIN</tt></td><td>The last fragment of the object.</td></tr>
          <tr><td>1</td><td><tt>ANCHOR</tt></td><td>The content is absolute and may be applied onto any held state.</td></tr>
          <tr><td>2</td><td><tt>RETRANSMIT</tt></td><td>The sender's own resend.</td></tr>
          <tr><td>3</td><td><tt>DUP</tt></td><td>A deliberate duplicate of an echo-critical object.</td></tr>
          <tr><td>4</td><td><tt>ECHO_REQUESTED</tt></td><td>The receiver must reply with ECHO_OF_OBJECT_ID and timestamps.</td></tr>
          <tr><td>5</td><td><tt>PROBE</tt></td><td>A probe object.</td></tr>
          <tr><td>6</td><td><tt>URGENT</tt></td><td>Control drains before queued media.</td></tr>
        </tbody>
        </table>
      <!-- END FLAGS -->
        <t><tt>FIN</tt> marks the last fragment of an object. A receiver
        MUST NOT deliver an object until it has seen <tt>FIN</tt> and every
        fragment index from zero through <tt>fragment_count - 1</tt>.</t>
        <t><tt>ANCHOR</tt> marks an update whose content is absolute: a
        receiver MAY apply it onto any state it holds. <tt>RETRANSMIT</tt>
        marks a resend by the sender's own policy. <tt>DUP</tt> marks a
        deliberate duplicate of an echo-critical object; a receiver that has
        already applied the object named by <tt>ECHO_OF_OBJECT_ID</tt> MUST
        NOT apply it twice. <tt>ECHO_REQUESTED</tt> obliges the receiver to
        answer with an echo that names the object. <tt>PROBE</tt> marks a
        capacity probe. <tt>URGENT</tt> asks a writer to drain the object
        before queued media.</t>
      </section>

      <section anchor="classes">
        <name>Classes and Priorities</name>
        <t>The <tt>class</tt> field selects the body grammar.</t>
        <!-- BEGIN CLASSES -->
        <table>
          <name>Fragment classes</name>
        <thead>
          <tr><th>Value</th><th>Name</th><th>Description</th></tr>
        </thead>
        <tbody>
          <tr><td>0</td><td><tt>CONTROL</tt></td><td>Lane handshake, session control, input, and close</td></tr>
          <tr><td>1</td><td><tt>CURSOR</tt></td><td>Pointer position and shape</td></tr>
          <tr><td>2</td><td><tt>MEDIA</tt></td><td>Opaque media updates and parity objects</td></tr>
          <tr><td>3</td><td><tt>FEEDBACK</tt></td><td>Acknowledgements, reports, probes, and probe echoes</td></tr>
          <tr><td>4</td><td><tt>PATH</tt></td><td>Path hints and path changes</td></tr>
        </tbody>
        </table>
      <!-- END CLASSES -->
        <t>Values 5 through 255 are not defined in version 1 and are
        rejected with <tt>BAD_CLASS</tt>. Section 12 defines the
        registry. The <tt>PATH</tt> class carries path hints; version 1
        defines no body for it, and a receiver ignores its payload.</t>
        <t>The <tt>priority</tt> field is an integer from 0 to 7, where 0 is
        the highest priority. Values above 7 are rejected with
        <tt>BAD_PRIORITY</tt>. A <tt>MEDIA</tt>-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
        <tt>MEDIA</tt> class, 6 is interactive media and 7 is background
        refresh. The assigned defaults are:</t>
        <table>
          <name>Default priority assignments</name>
          <thead>
            <tr><th>Priority</th><th>Use</th></tr>
          </thead>
          <tbody>
            <tr><td>0</td><td>Control and acknowledgements</td></tr>
            <tr><td>1</td><td>Input</td></tr>
            <tr><td>2</td><td>Feedback reports and probe echoes</td></tr>
            <tr><td>3</td><td>Hop reports</td></tr>
            <tr><td>4</td><td>Unassigned</td></tr>
            <tr><td>5</td><td>Cursor</td></tr>
            <tr><td>6</td><td>Interactive media</td></tr>
            <tr><td>7</td><td>Background refresh</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="extension">
        <name>Header Extension</name>
        <t>The header extension is a sequence of zero or more type-length-value
        (TLV) runs:</t>
        <artwork type="ascii-art"><![CDATA[
 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 ...          |
+---------------+---------------+-------------------------------+
]]></artwork>
        <t><tt>type</tt> is a u8. <tt>length</tt> is a u8 and gives the
        number of value bytes, from 0 through 255. The value is
        <tt>length</tt> bytes. The extension is the concatenation of whole
        runs; <tt>header_ext_len</tt> is either 0 or between 2 and 256
        inclusive. A run whose length would cross the end of the extension is
        a <tt>BAD_EXT</tt> error, and the whole fragment is rejected.</t>
        <t>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.</t>
        <t>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 <tt>META_MISMATCH</tt>. It MUST NOT choose one of the two
        values.</t>
      </section>

      <section anchor="tlv-registry">
        <name>Header Extension TLV Registry</name>
        <t>The following types are defined in version 1. A type not listed is
        either unassigned or experimental and is skipped.</t>
        <!-- BEGIN TLVS -->
        <table>
          <name>Header extension TLV types</name>
        <thead>
          <tr><th>Type</th><th>Name</th><th>Length</th><th>Class</th><th>Description</th></tr>
        </thead>
        <tbody>
          <tr><td><tt>0x01</tt></td><td><tt>UPDATE_ID</tt></td><td>8</td><td>C3</td><td>The update this fragment belongs to.</td></tr>
          <tr><td><tt>0x02</tt></td><td><tt>UPDATE_BASE</tt></td><td>8</td><td>C3</td><td>The update this one continues; 0 means self-contained.</td></tr>
          <tr><td><tt>0x03</tt></td><td><tt>PART</tt></td><td>4</td><td>C3</td><td>This fragment's part within its update.</td></tr>
          <tr><td><tt>0x04</tt></td><td><tt>UPDATE_BYTES</tt></td><td>4</td><td>C3</td><td>The update's total payload bytes.</td></tr>
          <tr><td><tt>0x05</tt></td><td><tt>CHAIN_EPOCH</tt></td><td>4</td><td>C3</td><td>The chain epoch.</td></tr>
          <tr><td><tt>0x06</tt></td><td><tt>REFLECTS_INPUT_SEQ</tt></td><td>8</td><td>C3</td><td>The highest input sequence the update's content includes.</td></tr>
          <tr><td><tt>0x07</tt></td><td><tt>SEND_EPOCH_MS</tt></td><td>8</td><td>C3,C4</td><td>The sender's session-relative millisecond at first emission.</td></tr>
          <tr><td><tt>0x08</tt></td><td><tt>DEADLINE_EPOCH_MS</tt></td><td>8</td><td>C3,C4</td><td>The absolute session-relative deadline.</td></tr>
          <tr><td><tt>0x09</tt></td><td><tt>ECHO_OF_OBJECT_ID</tt></td><td>4</td><td>C4</td><td>The object being echoed or acknowledged.</td></tr>
          <tr><td><tt>0x0A</tt></td><td><tt>BUDGET_BYTES</tt></td><td>4</td><td>C4</td><td>The sender's per-update budget.</td></tr>
          <tr><td><tt>0x0B</tt></td><td><tt>PACE_BPS</tt></td><td>4</td><td>C4</td><td>The sender's current pace.</td></tr>
          <tr><td><tt>0x0C</tt></td><td><tt>PATH_HINT</tt></td><td>1</td><td>C5</td><td>0 unknown, 1 stream, 2 dc-direct, 3 dc-turn, 4 quic.</td></tr>
          <tr><td><tt>0x0D</tt></td><td><tt>INPUT_SEQ</tt></td><td>8</td><td>C1</td><td>The input object's sequence.</td></tr>
          <tr><td><tt>0x0E</tt></td><td><tt>CELL_COUNT</tt></td><td>4</td><td>C3,C4</td><td>The sender's repair-grid size.</td></tr>
          <tr><td><tt>0x0F</tt></td><td><tt>COST_MS</tt></td><td>2</td><td>C4</td><td>A hop's measured processing cost.</td></tr>
          <tr><td><tt>0x10</tt></td><td><tt>STREAM_ID</tt></td><td>4</td><td>C3</td><td>The media stream this update belongs to; 0 is the default stream.</td></tr>
          <tr><td><tt>0x11</tt></td><td><tt>FEC_GROUP_ID</tt></td><td>8</td><td>C3</td><td>The update id whose parts this parity object protects.</td></tr>
          <tr><td><tt>0x12</tt></td><td><tt>FEC_K</tt></td><td>2</td><td>C3</td><td>How many parts the protected group holds, 2..8.</td></tr>
          <tr><td><tt>0x13</tt></td><td><tt>PATH_ID</tt></td><td>1</td><td>C3,C5</td><td>The path this fragment was sent over; 0 is the default path.</td></tr>
          <tr><td><tt>0x14</tt></td><td><tt>FEC_N</tt></td><td>2</td><td>C3</td><td>How many repair rows the group carries.</td></tr>
          <tr><td><tt>0x15</tt></td><td><tt>FEC_REPAIR_INDEX</tt></td><td>2</td><td>C3</td><td>Which repair row this parity object carries.</td></tr>
        </tbody>
        </table>
      <!-- END TLVS -->
        <t>Types <tt>0x16</tt> through <tt>0xEF</tt> are unassigned and are
        skipped by a version 1 receiver. Types <tt>0xF0</tt> through
        <tt>0xFF</tt> are experimental: they are skipped and counted. A
        receiver MUST NOT treat an unknown type as an error.</t>
        <t>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 <tt>BAD_EXT</tt> (or, when the value is used to mirror
        the body, <tt>META_MISMATCH</tt>).</t>
      </section>

      <section anchor="validation">
        <name>Fragment Validation</name>
        <t>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.</t>
        <ol>
          <li><t>The transport message is at least 22 bytes; otherwise
          <tt>BAD_LENGTH</tt>.</t></li>
          <li>The first four bytes are <tt>4d 4c 50 00</tt>; otherwise
          <tt>BAD_MAGIC</tt>.</li>
          <li><tt>version</tt> is 1; otherwise <tt>UNSUPPORTED_VERSION</tt>.</li>
          <li><tt>class</tt> is 0 through 4; otherwise
          <tt>BAD_CLASS</tt>.</li>
          <li>Bit 7 of <tt>flags</tt> is zero; otherwise
          <tt>BAD_FLAGS</tt>.</li>
          <li><tt>priority</tt> is 0 through 7, and a <tt>MEDIA</tt>
          fragment does not use 0 or 1; otherwise
          <tt>BAD_PRIORITY</tt>.</li>
          <li><tt>fragment_count</tt> is 1 through 4096 and
          <tt>fragment_index</tt> is less than <tt>fragment_count</tt>;
          otherwise <tt>BAD_FRAGMENT</tt>.</li>
          <li><tt>header_ext_len</tt> is 0 or between 2 and 256 inclusive;
          otherwise <tt>BAD_EXT</tt>.</li>
          <li><tt>payload_len</tt> is at most the carrier's fragment
          payload cap; otherwise <tt>BAD_LENGTH</tt>.</li>
          <li>The message contains the whole extension and body, and the
          extension is a sequence of whole TLVs; otherwise
          <tt>BAD_LENGTH</tt> or <tt>BAD_EXT</tt>.</li>
          <li>On a datagram carrier, the message carries exactly one
          fragment and <tt>fragment_count</tt> is 1; otherwise
          <tt>BAD_FRAGMENT</tt>.</li>
        </ol>
        <t>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.</t>
      </section>

      <section anchor="assembly">
        <name>Object Assembly</name>
        <t>An object is complete when every fragment index from zero through
        <tt>fragment_count - 1</tt> has arrived and a fragment with
        <tt>FIN</tt> 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
        <tt>fragment_count</tt> rejects the fragment with
        <tt>BAD_FRAGMENT</tt>.</t>
        <t>Object state is per lane and direction and is bounded:</t>
        <ul>
          <li><t>at most 4 objects open at once;</t></li>
          <li><t>at most 1 MiB of payload held across incomplete
          objects;</t></li>
          <li><t>a deduplication window of 4096
          <tt>(object_id, fragment_index)</tt> pairs.</t></li>
        </ul>
        <t>When a new fragment would exceed either the object count or the
        byte budget, the receiver evicts the oldest incomplete object and
        counts <tt>ASSEMBLY_EVICTED</tt>. An incomplete object that has been
        open for <tt>3 x RTT + 500 ms</tt> is discarded and counted
        <tt>ASSEMBLY_TIMEOUT</tt>. The timestamp is the arrival of the
        object's first fragment.</t>
        <t>A fragment whose <tt>(object_id, fragment_index)</tt> pair is
        already inside the deduplication window is a duplicate and is
        dropped. A fragment whose <tt>DEADLINE_EPOCH_MS</tt> is present and
        non-zero and has passed is dropped as expired; this is a local drop
        and is not reported to the peer.</t>
        <t>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.</t>
      </section>

      <section anchor="updates">
        <name>Update Model</name>
        <t>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:</t>
        <artwork type="ascii-art"><![CDATA[
update
  +-- part 0  -> object -> fragment 0 .. fragment n-1
  +-- part 1  -> object -> fragment 0 .. fragment n-1
  +-- ...
]]></artwork>
        <t>A <em>self-contained</em> update carries <tt>UPDATE_BASE = 0</tt>
        and may be applied onto any state the receiver holds. A
        <em>chained</em> update carries <tt>UPDATE_BASE &gt; 0</tt>, 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.</t>
        <t>The sender sets <tt>UPDATE_BASE</tt> 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 <tt>ANCHOR</tt>.
        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.</t>
        <t>The update metadata is carried in the header extension of every
        part. The fields are:</t>
        <table>
          <name>Update metadata</name>
          <thead>
            <tr><th>TLV</th><th>Meaning</th></tr>
          </thead>
          <tbody>
            <tr><td>UPDATE_ID</td><td>The update this part belongs to.</td></tr>
            <tr><td>UPDATE_BASE</td><td>The update this one continues; 0 means self-contained.</td></tr>
            <tr><td>PART</td><td>The part index and the part count of the update.</td></tr>
            <tr><td>UPDATE_BYTES</td><td>The total payload bytes of all parts, excluding framing. It is diagnostic and MUST NOT be compared with an encoded object's length.</td></tr>
            <tr><td>CHAIN_EPOCH</td><td>The sender's chain epoch.</td></tr>
            <tr><td>REFLECTS_INPUT_SEQ</td><td>The highest input sequence whose effect the update's content includes.</td></tr>
            <tr><td>SEND_EPOCH_MS</td><td>The sender's session-relative millisecond at first emission; preserved verbatim on a retransmit.</td></tr>
            <tr><td>STREAM_ID</td><td>The media stream; version 1 defines only stream 0.</td></tr>
            <tr><td>PATH_ID</td><td>The path the fragment was sent over; 0 is the default path.</td></tr>
            <tr><td>CELL_COUNT</td><td>The sender's coverage grid size, for the staleness arithmetic.</td></tr>
          </tbody>
        </table>
        <t>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.</t>
      </section>

      <section anchor="identities">
        <name>Identities and Monotonicity</name>
        <t>MLP has four identities, and they mean different things.</t>
        <table>
          <name>Identities</name>
          <thead>
            <tr><th>Identity</th><th>Space</th><th>Meaning</th><th>Not a signal for</th></tr>
          </thead>
          <tbody>
            <tr>
              <td><tt>object_id</tt></td>
              <td>Monotone per lane, direction, and sender epoch</td>
              <td>One object, for deduplication and for <tt>ECHO_OF_OBJECT_ID</tt></td>
              <td>Loss: a gap is not a lost object</td>
            </tr>
            <tr>
              <td><tt>UPDATE_ID</tt></td>
              <td>Monotone per lane, direction, and receiver</td>
              <td>One media update, for the acknowledgement window and convergence</td>
              <td>A codec's private counter</td>
            </tr>
            <tr>
              <td><tt>CHAIN_EPOCH</tt></td>
              <td>Monotone per session, sender-owned</td>
              <td>A break in the update chain</td>
              <td>A per-update counter</td>
            </tr>
            <tr>
              <td><tt>input_seq</tt></td>
              <td>Monotone per receiver epoch</td>
              <td>One input object, for deduplication and echo</td>
              <td>A media update identifier</td>
            </tr>
          </tbody>
        </table>
        <t>The <tt>object_id</tt> 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
        &quot;the receiver never saw this update&quot;. 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.</t>
        <t><tt>object_id</tt> 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.</t>
        <t><tt>UPDATE_ID</tt> is a 64-bit field and starts at 1. A value of 0
        in an acknowledgement means &quot;nothing applied yet&quot;.</t>
        <t><tt>CHAIN_EPOCH</tt> 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.</t>
      </section>

      <section anchor="grid">
        <name>Coverage Grid</name>
        <t>The sender partitions its surface into a rectangular grid of cells.
        The grid is negotiated in the handshake: <tt>cell_size</tt>,
        <tt>cell_cols</tt>, and <tt>cell_rows</tt> in <tt>MediaHello</tt> and
        <tt>MediaHelloAck</tt>. The cell size is a power of two between 32 and
        256 pixels. The grid is indexed row-major: cell
        <tt>row x cols + col</tt>.</t>
        <t>A grid with <tt>width</tt> and <tt>height</tt> pixels and cell size
        <tt>s</tt> has <tt>ceil(width / s) x ceil(height / s)</tt>
        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.</t>
        <t>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 <tt>applied_cell_count</tt> and
        <tt>stale_cells</tt> as zero; the update-level acknowledgement remains
        authoritative.</t>
        <t>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.</t>
      </section>
    </section>
    <section anchor="bodies">
      <name>Class Bodies</name>

      <section anchor="body-encoding">
        <name>Body Encoding</name>
        <t>The class bodies are encoded with a restricted Protocol Buffers
        wire format. Only three wire types are used:</t>
        <table>
          <name>Wire types</name>
          <thead>
            <tr><th>Wire type</th><th>Encoding</th><th>Used for</th></tr>
          </thead>
          <tbody>
            <tr><td>0</td><td>Base-128 varint</td><td>u32, u64, bool, enum</td></tr>
            <tr><td>1</td><td>64-bit little-endian</td><td>double</td></tr>
            <tr><td>2</td><td>Length-delimited: varint length followed by bytes</td><td>string, bytes, nested message</td></tr>
          </tbody>
        </table>
        <t>A field is encoded as a varint key
        <tt>(field_number &lt;&lt; 3) | wire_type</tt> 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 <tt>BODY_INVALID</tt>. A decoder MUST
        skip an unknown field by its wire type, so a future extension can be
        added without changing this grammar.</t>
        <t>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 <tt>oneof</tt> is invalid; the decoder MUST reject it
        with <tt>BODY_INVALID</tt>, not silently take the last one.</t>
        <t>The complete schema is Appendix B. The tables below state the
        field numbers and the semantics a peer needs.</t>
      </section>

      <section anchor="media-body">
        <name>MEDIA</name>
        <t>The <tt>MEDIA</tt> 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.</t>
        <t>A media object MUST carry an <tt>UPDATE_ID</tt> TLV. An object
        without one cannot be acknowledged and is rejected with
        <tt>BODY_INVALID</tt>. A media object whose priority is 0 or 1 is
        rejected with <tt>BAD_PRIORITY</tt>.</t>
      </section>

      <section anchor="cursor-body">
        <name>CURSOR</name>
        <t>The <tt>CURSOR</tt> class carries pointer position and,
        optionally, a pointer shape. It is unordered, latest-wins, and never
        retransmitted. A cursor object MUST NOT be fragmented:
        <tt>fragment_count</tt> 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.</t>
        <table>
          <name>MediaCursor fields</name>
          <thead>
            <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
          </thead>
          <tbody>
            <tr><td>1</td><td>i32</td><td>x_px</td><td>Pointer x in surface pixels.</td></tr>
            <tr><td>2</td><td>i32</td><td>y_px</td><td>Pointer y in surface pixels.</td></tr>
            <tr><td>3</td><td>bool</td><td>visible</td><td>Whether the pointer is visible.</td></tr>
            <tr><td>4</td><td>u32</td><td>shape_seq</td><td>Local shape generation; 0 means keep the local shape.</td></tr>
            <tr><td>5</td><td>u64</td><td>epoch_ms</td><td>The sender's session-relative time of the sample.</td></tr>
            <tr><td>6</td><td>u32</td><td>hot_spot_x</td><td>Shape hot spot x, when a shape is carried.</td></tr>
            <tr><td>7</td><td>u32</td><td>hot_spot_y</td><td>Shape hot spot y, when a shape is carried.</td></tr>
            <tr><td>8</td><td>bytes</td><td>shape_rgba</td><td>Optional shape, at most 8192 bytes.</td></tr>
          </tbody>
        </table>
        <t>A receiver validates a cursor body as follows: <tt>shape_rgba</tt>
        is at most 8192 bytes; and if <tt>visible</tt> is true,
        <tt>shape_seq</tt> is 0, and <tt>shape_rgba</tt> 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.</t>
      </section>

      <section anchor="feedback-body">
        <name>FEEDBACK</name>
        <t>The <tt>FEEDBACK</tt> 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:</t>
        <table>
          <name>FEEDBACK body selection</name>
          <thead>
            <tr><th>Priority</th><th>Flags</th><th>Body</th></tr>
          </thead>
          <tbody>
            <tr><td>0</td><td>Any</td><td><tt>MediaAck</tt></td></tr>
            <tr><td>2</td><td><tt>PROBE</tt> set</td><td><tt>MediaProbe</tt></td></tr>
            <tr><td>2</td><td><tt>ECHO_OF_OBJECT_ID</tt> TLV present</td><td><tt>ProbeEcho</tt></td></tr>
            <tr><td>2</td><td>Otherwise</td><td><tt>MediaFeedback</tt></td></tr>
            <tr><td>3</td><td>Any</td><td><tt>MediaHopReport</tt></td></tr>
          </tbody>
        </table>
        <t>A receiver MUST reject a feedback object that does not match one
        of these shapes with <tt>BODY_INVALID</tt>. A sender that emits a
        bare <tt>MediaAck</tt> MUST use priority 0; a sender that nests the
        acknowledgement in <tt>MediaFeedback</tt> uses priority 2 and leaves
        the bare-ack shape unused.</t>

        <section anchor="ack-body">
          <name>MediaAck</name>
          <t>A <tt>MediaAck</tt> 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 <tt>ack</tt> field of a
          <tt>MediaFeedback</tt>.</t>
          <table>
            <name>MediaAck fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u64</td><td>highest_applied_update_id</td><td>The highest update the receiver applied; 0 means nothing applied yet.</td></tr>
              <tr><td>2</td><td>u64</td><td>ack_bitmap</td><td>Bit <tt>i</tt> names update <tt>highest - i</tt>, for <tt>i</tt> in 0..63.</td></tr>
              <tr><td>3</td><td>u32</td><td>chain_epoch</td><td>The chain epoch the receiver has adopted.</td></tr>
              <tr><td>4</td><td>u32</td><td>applied_cell_count</td><td>The receiver's grid size.</td></tr>
              <tr><td>5</td><td>u32</td><td>stale_cells</td><td>The number of cells the receiver believes stale.</td></tr>
              <tr><td>6</td><td>bool</td><td>converged</td><td>The receiver's own convergence belief.</td></tr>
              <tr><td>7</td><td>double</td><td>render_latency_ms</td><td>Measured render latency, when meaningful.</td></tr>
              <tr><td>8</td><td>bool</td><td>has_render_latency_ms</td><td>Whether field 7 is meaningful.</td></tr>
              <tr><td>9</td><td>u64</td><td>echo_of_input_seq</td><td>The highest input sequence visible in the applied content.</td></tr>
              <tr><td>10</td><td>u64</td><td>ack_epoch_ms</td><td>The reporter's session-relative time; diagnostic only.</td></tr>
            </tbody>
          </table>
          <t>The window is 64 updates wide. A set bit <tt>i</tt> MUST satisfy
          <tt>i &lt; highest_applied_update_id</tt>; otherwise the
          acknowledgement is invalid (<tt>ACK_BAD_BITMAP</tt>, reported on
          the wire as <tt>BODY_INVALID</tt>). A receiver that reports fewer
          bits than the field holds is a different receiver: the sender reads
          the missing bits as &quot;not applied&quot; and re-sends content
          the receiver already holds.</t>
          <t><tt>stale_cells</tt> MUST NOT exceed
          <tt>applied_cell_count</tt> (<tt>ACK_BAD_COUNT</tt>). If
          <tt>has_render_latency_ms</tt> is false,
          <tt>render_latency_ms</tt> MUST be zero.</t>
          <t><tt>converged</tt> 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.</t>
        </section>

        <section anchor="feedback-message">
          <name>MediaFeedback</name>
          <t><tt>MediaFeedback</tt> is the receiver's measurement report. A
          report that closes a measurement window carries the window's
          counters and a non-zero <tt>window_ms</tt>. A <em>prompt</em>
          report, sent because the receiver holds an echo or a loss
          attribution the sender cannot wait for, carries
          <tt>window_ms = 0</tt> and is a sign of life, not a
          measurement.</t>
          <table>
            <name>MediaFeedback fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>rtt_ms</td><td>The receiver's measured round trip, clamped to 1..60000.</td></tr>
              <tr><td>2</td><td>u32</td><td>rtt_min_ms</td><td>The receiver's running minimum.</td></tr>
              <tr><td>3</td><td>u32</td><td>jitter_ms</td><td>The receiver's jitter estimate.</td></tr>
              <tr><td>4</td><td>u64</td><td>received_bytes</td><td>Payload bytes received in the window.</td></tr>
              <tr><td>5</td><td>u64</td><td>received_objects</td><td>Objects received in the window.</td></tr>
              <tr><td>6</td><td>u64</td><td>lost_objects</td><td>Updates the receiver never saw, counted in the update-id space.</td></tr>
              <tr><td>7</td><td>u64</td><td>duplicated_objects</td><td>Objects seen twice in the window.</td></tr>
              <tr><td>8</td><td>u64</td><td>reordered_objects</td><td>Objects that arrived out of order.</td></tr>
              <tr><td>9</td><td>u64</td><td>window_ms</td><td>The window length; 0 means the window is still open.</td></tr>
              <tr><td>10</td><td>message</td><td>ack</td><td>A <tt>MediaAck</tt>.</td></tr>
              <tr><td>11</td><td>repeated message</td><td>probes</td><td><tt>ProbeEcho</tt> values, when the report carries echoes.</td></tr>
              <tr><td>12</td><td>u32</td><td>buffered_amount_bytes</td><td>The receiver's outbound backlog.</td></tr>
              <tr><td>13</td><td>u32</td><td>display_fps</td><td>The measured display rate.</td></tr>
              <tr><td>14</td><td>u32</td><td>render_ms_p50</td><td>Render time, median.</td></tr>
              <tr><td>15</td><td>u32</td><td>render_ms_p95</td><td>Render time, 95th percentile.</td></tr>
              <tr><td>16</td><td>u32</td><td>input_queue_depth</td><td>The receiver's input queue depth.</td></tr>
              <tr><td>17</td><td>u64</td><td>input_submitted</td><td>Input objects submitted in the window.</td></tr>
              <tr><td>18</td><td>u64</td><td>input_expired</td><td>Input objects expired in the window.</td></tr>
              <tr><td>19</td><td>u64</td><td>path_switches</td><td>Carrier switches observed.</td></tr>
              <tr><td>20</td><td>u32</td><td>active_path</td><td>The active carrier (Section 6.4.5).</td></tr>
              <tr><td>21</td><td>string</td><td>app_version</td><td>Diagnostic application identifier.</td></tr>
              <tr><td>22</td><td>u32</td><td>loss_bursts</td><td>The number of loss bursts in the window.</td></tr>
              <tr><td>23</td><td>u32</td><td>lost_in_bursts</td><td>Updates lost in bursts.</td></tr>
              <tr><td>24</td><td>u32</td><td>max_burst</td><td>The longest burst in the window.</td></tr>
              <tr><td>25</td><td>u32</td><td>mean_burst_ewma_x16</td><td>The EWMA mean burst length, times 16.</td></tr>
            </tbody>
          </table>
          <t>Two derived values are normative:</t>
          <artwork type="ascii-art"><![CDATA[
goodput_bps = received_bytes * 8000 / window_ms     (window_ms > 0)
delivered_ratio = received / (received + lost_objects)
loss_ratio = 1 - delivered_ratio
]]></artwork>
          <t><tt>received_bytes</tt> counts payload bytes only; framing bytes
          and the header extension are not counted. <tt>lost_objects</tt> is
          counted in the update-id space, not the object-id space. A report
          with <tt>window_ms = 0</tt> 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.</t>
        </section>

        <section anchor="probe-body">
          <name>MediaProbe and ProbeEcho</name>
          <t>A probe is a <tt>FEEDBACK</tt> object with the <tt>PROBE</tt> and
          <tt>ECHO_REQUESTED</tt> flags set and a <tt>SEND_EPOCH_MS</tt> TLV.
          Its body is a <tt>MediaProbe</tt>.</t>
          <table>
            <name>MediaProbe fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>probe_id</td><td>A prober-local identifier; not an identity.</td></tr>
              <tr><td>2</td><td>u32</td><td>payload_bytes</td><td>The probe's payload size.</td></tr>
              <tr><td>3</td><td>u64</td><td>send_epoch_ms</td><td>The sender's session-relative emission time.</td></tr>
            </tbody>
          </table>
          <t>An echo answers a probe. It is a <tt>FEEDBACK</tt> object at
          priority 2 with an <tt>ECHO_OF_OBJECT_ID</tt> TLV and a
          <tt>SEND_EPOCH_MS</tt> TLV copied verbatim from the probed object.
          Its body is a <tt>ProbeEcho</tt>.</t>
          <table>
            <name>ProbeEcho fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>object_id</td><td>The object being answered.</td></tr>
              <tr><td>2</td><td>u64</td><td>send_epoch_ms</td><td>The prober's epoch, quoted verbatim.</td></tr>
              <tr><td>3</td><td>u64</td><td>echo_epoch_ms</td><td>The echoer's session-relative reply time.</td></tr>
              <tr><td>4</td><td>u32</td><td>payload_bytes</td><td>The answered probe's payload size.</td></tr>
            </tbody>
          </table>
          <t>The correlation is the <tt>object_id</tt> in the TLV, not
          <tt>probe_id</tt>. 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.</t>
        </section>

        <section anchor="hop-report">
          <name>MediaHopReport</name>
          <t>A hop reports what it dropped at <tt>FEEDBACK</tt> priority 3.
          The priority is the discriminator: a hop report is the only
          <tt>FEEDBACK</tt> body at priority 3.</t>
          <table>
            <name>MediaHopReport fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>hop</td><td>1 first intermediary, 2 edge, 3 datagram, 4 relay.</td></tr>
              <tr><td>2</td><td>u64</td><td>objects_dropped</td><td>Objects this hop discarded in the window.</td></tr>
              <tr><td>3</td><td>u64</td><td>bytes_dropped</td><td>Bytes discarded in the window.</td></tr>
              <tr><td>4</td><td>u64</td><td>coalesced</td><td>Objects coalesced in the window.</td></tr>
              <tr><td>5</td><td>u32</td><td>queue_depth_peak</td><td>Peak queue depth observed.</td></tr>
              <tr><td>6</td><td>u32</td><td>queue_depth_current</td><td>Current queue depth.</td></tr>
              <tr><td>7</td><td>u32</td><td>window_ms</td><td>The interval the report covers.</td></tr>
              <tr><td>8</td><td>u32</td><td>rtt_ms_own</td><td>The hop's own round trip to the next hop.</td></tr>
              <tr><td>9</td><td>u32</td><td>backpressure_ms</td><td>Time the writer waited on capacity.</td></tr>
            </tbody>
          </table>
          <t>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.</t>
        </section>
      </section>

      <section anchor="control-body">
        <name>CONTROL</name>
        <t>The <tt>CONTROL</tt> class carries a single
        <tt>MediaControlObject</tt>, a <tt>oneof</tt> whose field numbers are
        fixed by this document.</t>
        <table>
          <name>MediaControlObject oneof</name>
          <thead>
            <tr><th>Field</th><th>Body</th><th>Direction</th></tr>
          </thead>
          <tbody>
            <tr><td>1</td><td><tt>MediaHello</tt></td><td>Sender to receiver</td></tr>
            <tr><td>2</td><td><tt>MediaHelloAck</tt></td><td>Receiver to sender</td></tr>
            <tr><td>3</td><td><tt>MediaResume</tt></td><td>Receiver to sender</td></tr>
            <tr><td>4</td><td><tt>MediaResumeAck</tt></td><td>Sender to receiver</td></tr>
            <tr><td>5</td><td><tt>MediaLaneState</tt></td><td>Sender to receiver</td></tr>
            <tr><td>6</td><td>Reserved</td><td>MUST NOT be sent</td></tr>
            <tr><td>7</td><td><tt>MediaClose</tt></td><td>Either direction</td></tr>
            <tr><td>8</td><td><tt>MediaError</tt></td><td>Either direction</td></tr>
            <tr><td>9</td><td><tt>MediaPathChange</tt></td><td>Either direction</td></tr>
            <tr><td>10</td><td><tt>MediaDatagramSignal</tt></td><td>Either direction</td></tr>
          </tbody>
        </table>
        <t>A control object MUST contain exactly one field of this
        <tt>oneof</tt>. A body with zero or with more than one field is
        rejected with <tt>BODY_INVALID</tt>. Handshake, resume, close, and
        error objects are urgent and are drained ahead of queued media; lane
        state and path change are informational.</t>

        <section anchor="hello">
          <name>MediaHello</name>
          <table>
            <name>MediaHello fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>protocol_version</td><td>1.</td></tr>
              <tr><td>2</td><td>string</td><td>media_session_id</td><td>Empty for a fresh session; non-empty only in a resume.</td></tr>
              <tr><td>3</td><td>string</td><td>session_id</td><td>The control-lane session identifier.</td></tr>
              <tr><td>4</td><td>u32</td><td>max_fragment_payload</td><td>The sender's fragment payload cap: 1150 on a datagram carrier, 65536 on a stream carrier.</td></tr>
              <tr><td>5</td><td>u32</td><td>cell_size</td><td>The coverage grid's cell size.</td></tr>
              <tr><td>6</td><td>u32</td><td>cell_cols</td><td>The grid's column count.</td></tr>
              <tr><td>7</td><td>u32</td><td>cell_rows</td><td>The grid's row count.</td></tr>
              <tr><td>8</td><td>repeated string</td><td>capabilities</td><td>Capability names, Section 7.1.</td></tr>
              <tr><td>9</td><td>u32</td><td>encoder_max_fps</td><td>The sender's encoder ceiling.</td></tr>
              <tr><td>10</td><td>u64</td><td>start_epoch_ms</td><td>The sender's session-relative start time.</td></tr>
            </tbody>
          </table>
          <t>A <tt>MediaHello</tt> whose <tt>protocol_version</tt> is not 1 is
          rejected with <tt>UNSUPPORTED_VERSION</tt>. The sender's fragment
          payload cap is a claim; the receiver's answer is the
          minimum.</t>
        </section>

        <section anchor="hello-ack">
          <name>MediaHelloAck</name>
          <table>
            <name>MediaHelloAck fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>protocol_version</td><td>1.</td></tr>
              <tr><td>2</td><td>string</td><td>media_session_id</td><td>The assigned media session identifier.</td></tr>
              <tr><td>3</td><td>u32</td><td>accepted_fragment_payload</td><td>The minimum of the two sides' caps.</td></tr>
              <tr><td>4</td><td>u32</td><td>cell_size</td><td>The agreed cell size.</td></tr>
              <tr><td>5</td><td>u32</td><td>cell_cols</td><td>The agreed column count.</td></tr>
              <tr><td>6</td><td>u32</td><td>cell_rows</td><td>The agreed row count.</td></tr>
              <tr><td>7</td><td>repeated string</td><td>capabilities</td><td>The receiver's capabilities.</td></tr>
              <tr><td>8</td><td>u32</td><td>resume_ttl_seconds</td><td>The resume TTL; 0 means resumption is not offered.</td></tr>
              <tr><td>9</td><td>bool</td><td>media_supported</td><td>Whether the lane is admitted.</td></tr>
              <tr><td>10</td><td>string</td><td>media_unsupported_reason</td><td>Required when field 9 is false.</td></tr>
            </tbody>
          </table>
          <t>When <tt>media_supported</tt> is false, the reason MUST be one of
          <tt>protocol</tt>, <tt>disabled_by_policy</tt>, or
          <tt>no_sender_capability</tt>. The session continues; only the media
          lane is refused.</t>
        </section>

        <section anchor="resume-body">
          <name>MediaResume</name>
          <table>
            <name>MediaResume fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>string</td><td>resume_token</td><td>An opaque bearer token.</td></tr>
              <tr><td>2</td><td>u64</td><td>applied_update_id</td><td>The last update the receiver applied.</td></tr>
              <tr><td>3</td><td>u32</td><td>chain_epoch</td><td>The epoch the receiver holds.</td></tr>
              <tr><td>4</td><td>u64</td><td>ack_bitmap</td><td>The receiver's acknowledgement window.</td></tr>
              <tr><td>5</td><td>u64</td><td>input_seq_next</td><td>The receiver's next input sequence: the deduplication boundary.</td></tr>
              <tr><td>6</td><td>repeated u32</td><td>pressed_keys</td><td>Keys the receiver currently holds.</td></tr>
              <tr><td>7</td><td>repeated u32</td><td>pressed_buttons</td><td>Buttons the receiver currently holds.</td></tr>
              <tr><td>8</td><td>u32</td><td>active_path</td><td>The carrier the receiver believes is active.</td></tr>
              <tr><td>9</td><td>string</td><td>dc_transport_id</td><td>A fresh negotiation identifier when the receiver renegotiated.</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="resume-ack-body">
          <name>MediaResumeAck</name>
          <table>
            <name>MediaResumeAck fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>bool</td><td>accepted</td><td>Whether the parked state was attached.</td></tr>
              <tr><td>2</td><td>string</td><td>reason</td><td>A resume reason (Section 7.4).</td></tr>
              <tr><td>3</td><td>u64</td><td>next_update_id</td><td>The update identifier the sender will use next.</td></tr>
              <tr><td>4</td><td>u64</td><td>pending_cells</td><td>The cells the sender will cover in its next whole state.</td></tr>
              <tr><td>5</td><td>u32</td><td>pace_bps</td><td>The current pace.</td></tr>
              <tr><td>6</td><td>u32</td><td>budget_bytes</td><td>The current per-update budget.</td></tr>
              <tr><td>7</td><td>u32</td><td>target_fps</td><td>The current target rate.</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="lane-state-body">
          <name>MediaLaneState</name>
          <table>
            <name>MediaLaneState fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>state</td><td>0 STARTING, 1 LIVE, 2 DEGRADED, 3 CONVERGING, 4 STALE, 5 PARKED, 6 DISABLED, 7 DECODE_BOUND, 8 NO_FEEDBACK, 9 MEDIA_UNSUPPORTED.</td></tr>
              <tr><td>2</td><td>u64</td><td>since_epoch_ms</td><td>When the state was entered.</td></tr>
              <tr><td>3</td><td>string</td><td>detail</td><td>A diagnostic detail string.</td></tr>
            </tbody>
          </table>
          <t>The states and their transitions are normative in Section
          7.2.</t>
        </section>

        <section anchor="close-body">
          <name>MediaClose</name>
          <table>
            <name>MediaClose fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>code</td><td>0 normal, 1 server_shutdown, 2 policy, 3 superseded, 4 park.</td></tr>
              <tr><td>2</td><td>string</td><td>reason</td><td>A human-readable reason.</td></tr>
              <tr><td>3</td><td>bool</td><td>park</td><td>The &quot;come back&quot; signal; a receiver MUST NOT treat it as a failure.</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="error-body">
          <name>MediaError</name>
          <table>
            <name>MediaError fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>code</td><td>An error code from the registry in Section 12.</td></tr>
              <tr><td>2</td><td>u32</td><td>object_id</td><td>The object the error concerns; 0 when none.</td></tr>
              <tr><td>3</td><td>string</td><td>detail</td><td>A diagnostic detail string.</td></tr>
            </tbody>
          </table>
          <t>A <tt>MediaError</tt> whose code is not in the registry is
          invalid (<tt>BODY_INVALID</tt>). 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.</t>
        </section>

        <section anchor="path-change-body">
          <name>MediaPathChange</name>
          <table>
            <name>MediaPathChange fields</name>
            <thead>
              <tr><th>Field</th><th>Type</th><th>Name</th><th>Meaning</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>u32</td><td>from_path</td><td>0 unknown, 1 stream, 2 dc-direct, 3 dc-turn, 4 quic.</td></tr>
              <tr><td>2</td><td>u32</td><td>to_path</td><td>The new carrier.</td></tr>
              <tr><td>3</td><td>string</td><td>reason</td><td>A diagnostic reason.</td></tr>
              <tr><td>4</td><td>u64</td><td>at_epoch_ms</td><td>The sender's session-relative time of the switch.</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="datagram-signal-body">
          <name>MediaDatagramSignal</name>
          <t>The datagram setup is a <tt>oneof</tt> carried on the control
          lane, never on the carrier it establishes.</t>
          <table>
            <name>MediaDatagramSignal oneof</name>
            <thead>
              <tr><th>Field</th><th>Body</th><th>Fields</th></tr>
            </thead>
            <tbody>
              <tr><td>1</td><td>MediaDatagramOffer</td><td>1: string sdp</td></tr>
              <tr><td>2</td><td>MediaDatagramAnswer</td><td>1: string sdp</td></tr>
              <tr><td>3</td><td>MediaDatagramCandidate</td><td>1: string candidate; 2: string sdp_mid; 3: u32 sdp_mline_index</td></tr>
              <tr><td>4</td><td>MediaDatagramClose</td><td>1: string reason</td></tr>
            </tbody>
          </table>
          <t>The SDP and candidate strings are carried verbatim
          <xref target="RFC8866"/> <xref target="RFC8445"/>. The sender is
          the offerer; the receiver answers. A peer that cannot carry the
          carrier ignores the offer.</t>
        </section>
      </section>

      <section anchor="input-body">
        <name>Input Objects</name>
        <t>An input object is a <tt>CONTROL</tt>-class object at priority 1.
        Its body is not a protobuf message; it is the following
        little-endian envelope:</t>
        <artwork type="ascii-art"><![CDATA[
 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)                                   |
+---------------------------------------------------------------+
]]></artwork>
        <t>The five-byte ASCII marker <tt>input</tt> 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 <tt>payload_len</tt> MUST equal the number of bytes that
        follow it.</t>
        <table>
          <name>Input kinds</name>
          <thead>
            <tr><th>Value</th><th>Kind</th></tr>
          </thead>
          <tbody>
            <tr><td>0</td><td>pointer_move</td></tr>
            <tr><td>1</td><td>pointer_button</td></tr>
            <tr><td>2</td><td>key</td></tr>
            <tr><td>3</td><td>wheel</td></tr>
            <tr><td>4</td><td>clipboard</td></tr>
            <tr><td>5</td><td>release_all</td></tr>
            <tr><td>6</td><td>pressed_set</td></tr>
          </tbody>
        </table>
        <t><tt>flags</tt> is a bit field: 0x01 RELEASE, 0x02 REPEAT, 0x04
        CRITICAL. Unknown bits MUST be ignored. The pressed-set payload is
        <tt>u32 key_count || u32 keys... || u32 button_count || u32
        buttons...</tt>.</t>
      </section>
    </section>
    <section anchor="session">
      <name>Session Lifecycle</name>

      <section anchor="handshake">
        <name>Handshake</name>
        <t>A media lane begins with a <tt>MediaHello</tt> from the sender
        followed by a <tt>MediaHelloAck</tt> 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.</t>
        <t>The hello negotiates:</t>
        <ul>
          <li><t>the protocol version, which is 1;</t></li>
          <li><t>the media session identifier: empty for a fresh session, and
          assigned by the receiver in the acknowledgement;</t></li>
          <li><t>the fragment payload cap: the receiver accepts the minimum
          of the two sides' caps;</t></li>
          <li><t>the coverage grid: cell size, columns, and rows;</t></li>
          <li><t>the capabilities each side offers;</t></li>
          <li><t>the sender's encoder ceiling and session start
          time;</t></li>
          <li><t>the resume TTL, when the receiver offers resumption.</t></li>
        </ul>
        <t>The following capability names are defined. A capability name is
        an ASCII string; an unknown name MUST be ignored.</t>
        <table>
          <name>Capabilities</name>
          <thead>
            <tr><th>Name</th><th>Meaning</th></tr>
          </thead>
          <tbody>
            <tr><td>anchor</td><td>The peer supports anchor updates and may apply them onto any held state.</td></tr>
            <tr><td>cursor</td><td>The peer supports <tt>CURSOR</tt> objects.</td></tr>
            <tr><td>dupe</td><td>The peer supports echo-critical duplication.</td></tr>
            <tr><td>probe</td><td>The peer supports probes and probe echoes.</td></tr>
            <tr><td>datagram</td><td>The peer supports a WebRTC data-channel carrier.</td></tr>
            <tr><td>hop_report</td><td>The peer supports hop reports on a deployment-defined hop channel.</td></tr>
          </tbody>
        </table>
        <t>Version 1 defines no version negotiation. A peer that receives a
        <tt>MediaHello</tt> or <tt>MediaHelloAck</tt> whose
        <tt>protocol_version</tt> is not 1 MUST refuse the lane with
        <tt>UNSUPPORTED_VERSION</tt>. 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.</t>
        <t>If the receiver cannot admit the lane, it answers with
        <tt>media_supported = false</tt> and a typed reason. The session
        continues; only the media lane is refused. The reason is one of
        <tt>protocol</tt>, <tt>disabled_by_policy</tt>, or
        <tt>no_sender_capability</tt>.</t>
      </section>

      <section anchor="lane-states">
        <name>Lane States</name>
        <t>A lane has two observers. The sender publishes
        <tt>MediaLaneState</tt>: 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.</t>
        <table>
          <name>The three facts</name>
          <thead>
            <tr><th>Fact</th><th>Receiver measures</th><th>Sender measures</th></tr>
          </thead>
          <tbody>
            <tr><td>Freshness</td><td>The time since the last applied update</td><td>The time since the receiver's applied-update watermark advanced</td></tr>
            <tr><td>Convergence</td><td>The cells it believes stale</td><td>The pending set the acknowledgement names</td></tr>
            <tr><td>Quality</td><td>The loss it attributed in the update-id space</td><td>The same ratio, read from the feedback</td></tr>
          </tbody>
        </table>
        <t>The states, in precedence order, are:</t>
        <table>
          <name>Lane states</name>
          <thead>
            <tr><th>State</th><th>Entered when</th><th>Left when</th></tr>
          </thead>
          <tbody>
            <tr><td>MEDIA_UNSUPPORTED</td><td>The peer does not speak this version, or policy forbids the lane.</td><td>Terminal.</td></tr>
            <tr><td>DISABLED</td><td>Media is switched off by policy or a kill switch.</td><td>The switch is cleared.</td></tr>
            <tr><td>STARTING</td><td>The handshake has not completed.</td><td>The handshake completes.</td></tr>
            <tr><td>PARKED</td><td>The peer is away and its state is held.</td><td>The peer resumes, or the park TTL expires.</td></tr>
            <tr><td>NO_FEEDBACK</td><td>No sign of life for <tt>3 x report_interval + 2 s</tt>.</td><td>One sign of life: a report, an acknowledgement, or a probe echo.</td></tr>
            <tr><td>STALE</td><td>No update applied within <tt>3 x (report_interval + 1 s)</tt>.</td><td>One update is applied.</td></tr>
            <tr><td>DECODE_BOUND</td><td>The receiver reports a decode time above half the update interval, and the sender implements decode-bound clamping.</td><td>The decode time falls below the threshold.</td></tr>
            <tr><td>CONVERGING</td><td>The receiver holds cells the sender emitted, above 25% of the grid.</td><td>The pending set is empty or at or below 25%.</td></tr>
            <tr><td>DEGRADED</td><td>The attributed loss ratio is above 5%.</td><td>The ratio is back at or below 5%.</td></tr>
            <tr><td>LIVE</td><td>None of the above applies.</td><td>Any fact leaves its condition.</td></tr>
          </tbody>
        </table>
        <t>The precedence order is: <tt>MEDIA_UNSUPPORTED</tt> &gt;
        <tt>DISABLED</tt> &gt; <tt>STARTING</tt> &gt; <tt>PARKED</tt> &gt;
        <tt>NO_FEEDBACK</tt> &gt; <tt>STALE</tt> &gt; <tt>DECODE_BOUND</tt>
        &gt; <tt>CONVERGING</tt> &gt; <tt>DEGRADED</tt> &gt;
        <tt>LIVE</tt>. An end reports the most significant state that
        applies.</t>
        <t>Neither end's <tt>LIVE</tt> overrides the other's staleness. A
        receiver whose own freshness is exhausted MUST report
        <tt>STALE</tt> whatever the sender last said; a sender that has seen
        no advancing watermark within the budget MUST report <tt>STALE</tt>
        whatever the receiver last reported.</t>
        <t>An implementation that does not measure decode time never enters
        <tt>DECODE_BOUND</tt>; 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
        <tt>DEGRADED</tt> because its pace is below a nominal rate. Loss is
        the quality fact both ends can measure.</t>
        <t>A lane that is open but stalled -- the carrier is up, objects
        flow, acknowledgements arrive, and the content does not advance
        -- is <tt>STALE</tt>. It is not <tt>DEGRADED</tt> (nothing was
        lost) and not <tt>LIVE</tt> (the content is not advancing). The first
        update the receiver applies ends the state.</t>
      </section>

      <section anchor="parking">
        <name>Parking</name>
        <t>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.</t>
        <t>The park TTL is
        <tt>clamp(2 x outage_target + 60 s, 120 s, 900 s)</tt>; a
        deployment with no configured outage target uses 300 seconds. The
        resume token's TTL is advertised in <tt>MediaHelloAck</tt> and is
        independent of the park TTL; a token whose TTL has passed is refused
        with <tt>token_expired</tt>.</t>
        <t>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.</t>
        <t>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.</t>
      </section>

      <section anchor="resume">
        <name>Resume</name>
        <t>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:</t>
        <ul>
          <li><t>the token MUST be unforgeable by anyone who does not hold the
          session's identity;</t></li>
          <li><t>it MUST carry, or be bound to, the session, the peer that may
          resume it, and a single-use generation;</t></li>
          <li><t>the generation MUST advance on every use, so a replayed token
          is detectable and refused;</t></li>
          <li><t>it MUST expire, and the expiry MUST be enforced by the party
          that validates it;</t></li>
          <li><t>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.</t></li>
        </ul>
        <t>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.</t>
        <t>The resume exchange is:</t>
        <artwork type="ascii-art"><![CDATA[
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 ---------------------->|
]]></artwork>
        <t>The <tt>MediaResumeAck.reason</tt> values are:</t>
        <table>
          <name>Resume reasons</name>
          <thead>
            <tr><th>Reason</th><th>Meaning</th><th>Action</th></tr>
          </thead>
          <tbody>
            <tr><td>ok</td><td>The parked state was attached.</td><td>Rebase and continue.</td></tr>
            <tr><td>unknown_session</td><td>No such session exists.</td><td>Start a fresh session.</td></tr>
            <tr><td>token_expired</td><td>The token's expiry has passed.</td><td>Start a fresh session.</td></tr>
            <tr><td>token_invalid</td><td>The token's signature or shape is invalid.</td><td>Start a fresh session.</td></tr>
            <tr><td>peer_mismatch</td><td>The token names another receiver or sender.</td><td>Terminal for this token.</td></tr>
            <tr><td>epoch_stale</td><td>The receiver's epoch is older than the sender's.</td><td>Start a fresh media session.</td></tr>
            <tr><td>epoch_mismatch</td><td>The receiver's epoch differs but is not older.</td><td>Rebase; the sender adopts the greater epoch.</td></tr>
            <tr><td>park_evicted</td><td>The parked state was evicted.</td><td>Start a fresh media session.</td></tr>
          </tbody>
        </table>
        <t>If the resume is refused with <tt>park_evicted</tt> or
        <tt>epoch_stale</tt>, the sender starts a fresh session for the same
        receiver: a new media session identifier, <tt>chain_epoch++</tt>, and
        one anchor update. There is no control-lane re-handshake.</t>
        <t>Sequence continuity is preserved: the <tt>object_id</tt> counter
        continues and is never reset by a resume; the update identifier
        continues per receiver; and the input sequence space continues, with
        <tt>input_seq_next</tt> in <tt>MediaResume</tt> as the deduplication
        boundary.</t>
        <t>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.</t>
      </section>

      <section anchor="close">
        <name>Close</name>
        <t>A <tt>MediaClose</tt> is a protocol object, not a carrier close. It
        carries a code and a <tt>park</tt> flag. The codes are 0
        <tt>normal</tt>, 1 <tt>server_shutdown</tt>, 2 <tt>policy</tt>, 3
        <tt>superseded</tt>, and 4 <tt>park</tt>. A close with
        <tt>park = true</tt> is the &quot;come back&quot; signal: the receiver
        MUST NOT treat it as a failure, and it reconnects according to the
        ladder.</t>
        <t>A carrier close without a <tt>MediaClose</tt> is an ungraceful
        end. The session enters the reconnect ladder; the sender keeps the
        per-receiver state until the park TTL expires.</t>
      </section>

      <section anchor="reconnect">
        <name>Reconnect Ladder</name>
        <t>The receiver's reconnect ladder is RTT-relative and unbounded. Let
        <tt>base = max(500 ms, RTT_smoothed)</tt>. The delay before attempt
        <tt>n</tt> is:</t>
        <artwork type="ascii-art"><![CDATA[
delay(0) = 0
delay(n) = clamp(base * 2^(n-1), 500 ms, 30 s) + jitter(0 .. 250 ms)
]]></artwork>
        <t>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.</t>
        <t>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.</t>
        <t>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.</t>
      </section>
    </section>
    <section anchor="delivery">
      <name>Delivery and Rate Adaptation</name>

      <section anchor="delivery-overview">
        <name>Overview</name>
        <t>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.</t>
      </section>

      <section anchor="capacity">
        <name>Capacity Estimation</name>
        <t>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.</t>

        <section anchor="probes">
          <name>Capacity Probes</name>
          <t>The estimator carries its own instrument. Every
          <tt>probe_interval</tt> (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
          <tt>FEEDBACK</tt>-class object with the <tt>PROBE</tt> and
          <tt>ECHO_REQUESTED</tt> flags, a <tt>SEND_EPOCH_MS</tt> TLV, and a
          <tt>MediaProbe</tt> body. Its payload is
          <tt>clamp(0.25 s x pace / 8, 1 byte, 8192 bytes)</tt>. 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.</t>
          <t>At most one probe is outstanding. The managed probe rate is
          <tt>max(managed_rate, 1.25 x pace)</tt>, 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.</t>
          <t>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
          <tt>max(pace_floor, probe_rate x delivered_ratio)</tt>, then
          raises it by the receiver's goodput, and halves the next probe
          rate. A probe whose echo does not arrive within
          <tt>2 x RTT + 250 ms</tt> 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.</t>
          <t>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.</t>
        </section>

        <section anchor="capacity-signals">
          <name>Capacity Signals</name>
          <ul>
            <li><t><strong>Goodput.</strong> <tt>received_bytes x 8000
            / window_ms</tt>, payload bytes only. It raises the capacity to
            at least its value.</t></li>
            <li><t><strong>Probe echoes.</strong> The round trip is
            <tt>now - SEND_EPOCH_MS</tt> on the sender's own clock. The two
            ends' session clocks are not compared.</t></li>
            <li><t><strong>Hop drops.</strong> When a hop reports
            <tt>objects_dropped</tt>, the drop fraction
            <tt>drops / (drops + received_objects)</tt> reduces the capacity,
            never below the floor. A coalesced object is not a drop.</t></li>
            <li><t><strong>Delay.</strong> <tt>queue_delay = RTT_ewma -
            RTT_min</tt> is recorded and reported; it is a congestion signal
            for the deployment and a diagnostic for the estimator.</t></li>
          </ul>
          <t><tt>RTT_min</tt> is the minimum over a 60-second sliding
          horizon. <tt>RTT_ewma</tt> uses alpha = 1/8. Jitter uses
          alpha = 1/4 over the absolute deviation from the previous
          smoothed value.</t>
        </section>

        <section anchor="estimator-modes">
          <name>Estimator Modes</name>
          <table>
            <name>Estimator modes</name>
            <thead>
              <tr><th>Mode</th><th>Condition</th><th>Effect</th></tr>
            </thead>
            <tbody>
              <tr><td>StartUp</td><td>No capacity has been measured yet.</td><td>Pace at the floor; the first probe asks for 1 Mbps.</td></tr>
              <tr><td>Steady</td><td>A capacity has been measured and the last probe was clean.</td><td>Pace at the measured capacity.</td></tr>
              <tr><td>Degraded</td><td>The last probe found congestion.</td><td>Pace at the reduced capacity; the next probe halves.</td></tr>
              <tr><td>Floor</td><td>The capacity is at the pace floor.</td><td>Pace at the floor; media is limited to the essential classes.</td></tr>
              <tr><td>NoFeedback</td><td>No sign of life for <tt>3 x report_interval + 2 s</tt>.</td><td>Pace at <tt>2 x floor</tt>, one update per second, no speculation.</td></tr>
            </tbody>
          </table>
          <t>The pace is <tt>min(capacity, ceiling)</tt>, clamped to
          <tt>[8000, 50 000 000]</tt> bits per second. A deployment MAY lower
          the ceiling; it MUST NOT raise it above 50 Mbps.</t>
        </section>

        <section anchor="budgets">
          <name>Budgets</name>
          <artwork type="ascii-art"><![CDATA[
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)
]]></artwork>
          <t><tt>max_object_bytes</tt> 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.</t>
          <t>When <tt>budget_bytes</tt> is below
          <tt>min_delta_bytes = 8192</tt>, the scheduler lowers the update
          rate so that each update carries a worthwhile amount of content:
          <tt>target_fps = max(0.5, 30 x budget_bytes / 8192)</tt>,
          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.</t>
        </section>

        <section anchor="priors">
          <name>Priors</name>
          <t>A sender MAY remember the rate a receiver's link sustained and
          start a new session at <tt>pace_0 = clamp(remembered_bps / 4, 8000,
          min(2 000 000, ceiling))</tt>. 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.</t>
        </section>

        <section anchor="no-feedback">
          <name>Missing Feedback</name>
          <t>If no sign of life arrives for
          <tt>3 x report_interval + 2 s</tt>, the estimator enters
          <tt>NoFeedback</tt>. The pace becomes <tt>2 x pace_floor</tt>,
          the target rate becomes 1 update per second, and the maximum object
          becomes one report interval of that pace, clamped to
          <tt>[1024, 524288]</tt>. One sign of life clears the mode.</t>
          <t>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.</t>
          <t>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.</t>
        </section>
      </section>

      <section anchor="pacing">
        <name>Pacing</name>
        <t>Each lane has one token bucket per direction. The bucket's
        capacity is</t>
        <artwork type="ascii-art"><![CDATA[
capacity = min( max(2 * max_object_bytes, (pace_bps / 8) * 20 ms),
                max(1.25 * (pace_bps / 8) * 1 s, max_grant_bytes) )
]]></artwork>
        <t>and it refills at <tt>pace_bps / 8</tt> 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.</t>
        <t><tt>max_grant_bytes</tt> is the carrier's fragment payload cap on a
        stream carrier (65536) and <tt>min(carrier cap, 16384)</tt> on a
        datagram carrier (1150 in practice). A request above it is the
        sender's segmentation bug, not a pacing problem.</t>
        <t>The reserved rate is <tt>max(2000, 0.10 x pace_bps)</tt> bits
        per second. A media object may not be released if doing so would
        leave less than <tt>reserved_rate / 8 x max(RTT, 250 ms)</tt>
        bytes in the bucket. Non-media classes may borrow from the media
        tokens; the reverse never happens.</t>
        <t>The pacer also enforces a one-second rolling window of
        <tt>max(1.25 x pace_bps / 8, max_grant_bytes)</tt> 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.</t>
        <t>An <em>idle object</em> is an empty update, <tt>update_bytes =
        0</tt>, chained onto the current surface. It is emitted at most once
        per <tt>clamp(2 x RTT, 1000 ms, 3000 ms)</tt>. It keeps the
        acknowledgement timeline and the lane alive, and it costs about 60
        bytes.</t>
      </section>

      <section anchor="scheduling">
        <name>Update Scheduling</name>
        <t>An update is due every <tt>1000 / target_fps</tt> milliseconds.
        The sender produces the update from the content layer's current
        state, splits it into parts, and hands the parts to the pacer.</t>
        <t>On an input event for a receiver, the sender opens a pulse window
        of <tt>max(300 ms, RTT)</tt> and schedules an immediate update. During
        the window the target rate is
        <tt>min(30, max(4, 2 x target_fps))</tt>, and the pulse's budget
        is <tt>min(budget_bytes, max(1024, pace_bps / 8 x 0.25 s))</tt>.
        The pacer still enforces the pace, so a pulse can be delayed but can
        never violate the rate. The pulse carries
        <tt>REFLECTS_INPUT_SEQ</tt>.</t>
        <t>A payload is split into at most <tt>max_parts</tt> parts, where
        the per-part size is
        <tt>min(491520, budget_bytes, carrier_cap)</tt>. <tt>max_parts</tt>
        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.</t>
        <t>An object above <tt>max_object_bytes</tt> is dropped and counted,
        not sent. Its cells stay pending; the next whole state covers
        them.</t>
      </section>

      <section anchor="acknowledgements">
        <name>Acknowledgements</name>
        <t>A receiver acknowledges the updates it applied with a 64-update
        window. <tt>highest_applied_update_id</tt> names the newest applied
        update, and bit <tt>i</tt> of <tt>ack_bitmap</tt> names update
        <tt>highest - i</tt>. An update identifier of 0 means &quot;nothing
        applied yet&quot;.</t>
        <t>A receiver reports at the idle cadence
        <tt>clamp(4 x RTT_min, 250 ms, 2 s)</tt>, 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
        <tt>clamp(RTT_min / 4, 25 ms, 250 ms)</tt>. A prompt report carries
        <tt>window_ms = 0</tt>; the sender reads it as an acknowledgement and
        a sign of life, never as a measurement.</t>
        <t>On an acknowledgement, the sender clears a cell from the pending
        set only when the update that <em>last wrote</em> 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.</t>
        <t>The sender keeps a ring of update-to-cell mappings of
        <tt>max(64, ceil(2 x RTT / update_interval) + 8)</tt> 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.</t>
        <t>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.</t>
      </section>

      <section anchor="convergence">
        <name>Convergence and Repair</name>
        <t>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.</t>
        <t>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.</t>
        <t>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.</t>
        <t>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 <tt>no_sender_capability</tt>.</t>
      </section>

      <section anchor="fec">
        <name>Forward Error Correction</name>
        <t>Wire parity is an optional repair path for a lane whose loss is
        measured, not assumed. A group of <tt>k</tt> parts travels with
        <tt>n</tt> repair symbols, and any <tt>k</tt> of the group's
        <tt>k + n</tt> symbols rebuild all <tt>k</tt> parts. The code is
        systematic: the first <tt>k</tt> symbols are the parts themselves.</t>
        <t>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:</t>
        <ul>
          <li><t>inside the band <tt>2% &lt;= loss &lt; 25%</tt>, the largest
          of 1, the window's longest burst, and
          <tt>ceil(8 x loss)</tt>, capped at 8;</t></li>
          <li><t>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;</t></li>
          <li><t>below 2%, one level lower per clean window, until
          zero;</t></li>
          <li><t>with no loss signal at all, the previous count
          holds.</t></li>
        </ul>
        <t>A group is one update's parts, and only an update with two or more
        parts takes parity. <tt>k</tt> is the part count and is at most 8;
        <tt>n</tt> 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.</t>
        <t>Each parity object is a <tt>MEDIA</tt>-class object that follows
        the update's parts, carries the update's own metadata, and adds:</t>
        <table>
          <name>Parity metadata</name>
          <thead>
            <tr><th>TLV</th><th>Meaning</th></tr>
          </thead>
          <tbody>
            <tr><td>FEC_GROUP_ID</td><td>The update identifier whose parts the group protects.</td></tr>
            <tr><td>FEC_K</td><td>The group's part count, 2 through 8.</td></tr>
            <tr><td>FEC_N</td><td>The group's repair count, 1 through 8; absent means 1.</td></tr>
            <tr><td>FEC_REPAIR_INDEX</td><td>The repair row this object carries, 0 through <tt>FEC_N - 1</tt>; absent means 0.</td></tr>
          </tbody>
        </table>
        <t>The parity payload is self-describing. Each part is a block
        <tt>u16 length || payload</tt>, zero-padded to the group's longest
        block. The blocks are combined over GF(256) with the polynomial
        <tt>0x11D</tt>. Repair row <tt>r</tt> combines data column <tt>j</tt>
        with the Cauchy coefficient <tt>1 / (r XOR (8 + j))</tt>; the two
        index ranges are disjoint, so the denominator never vanishes. Each
        row is followed by a <tt>u32</tt> CRC-32 (IEEE) over the concatenated
        blocks in part-index order.</t>
        <t>A receiver holds the newest eight groups' parts and repair rows by
        index. As soon as a group holds at least <tt>k</tt> of its
        <tt>k + n</tt> 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.</t>
        <t>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.</t>
      </section>

      <section anchor="duplicates">
        <name>Duplicate Transmission</name>
        <t>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 <tt>DUP</tt> flag and the
        <tt>ECHO_OF_OBJECT_ID</tt> of the object it repeats. Application is
        idempotent by <tt>object_id</tt> and by
        <tt>(UPDATE_ID, PART)</tt>: a receiver that has already applied the
        named object MUST NOT apply it twice.</t>
        <t>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.</t>
      </section>
    </section>

    <section anchor="input">
      <name>Input Path</name>
      <t>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.</t>

      <section anchor="input-object">
        <name>Input Object</name>
        <t>An input object is a <tt>CONTROL</tt>-class object at priority 1.
        Its body is the <tt>input</tt> 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.</t>
        <ul>
          <li><t><tt>input_seq</tt> is monotone within a receiver's epoch and
          opaque to every peer except the receiver that produced it and the
          sender that consumes it.</t></li>
          <li><t><tt>deadline_epoch_ms</tt> is an absolute session-relative
          deadline; 0 means &quot;never expires&quot;.</t></li>
          <li><t><tt>kind</tt> and <tt>flags</tt> are transport-level, so a
          hop can coalesce or drop an input object without decoding the
          payload.</t></li>
          <li><t><tt>payload</tt> is the input's own serialized content,
          unchanged by the transport.</t></li>
        </ul>
      </section>

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

      <section anchor="input-hops">
        <name>Hop and Sender Rules</name>
        <ol>
          <li><t><strong>Session owner.</strong> 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
          <tt>(receiver_epoch, input_seq)</tt> with a 4096-entry window, and a
          frame that fails validation is rejected whole.</t></li>
          <li><t><strong>Intermediary.</strong> 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.</t></li>
          <li><t><strong>Sender.</strong> 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 <tt>release_all</tt>,
          <tt>pressed_set</tt>, and any object with the <tt>RELEASE</tt> flag,
          which are always applied.</t></li>
          <li><t><strong>Pressed set.</strong> The receiver sends a
          <tt>pressed_set</tt> carrying the keys and buttons it holds, at
          resume and every <tt>clamp(2 x RTT, 5 s, 30 s)</tt>. The
          sender keeps its own pressed set, and on every <tt>pressed_set</tt>
          it releases every key and button it believes pressed that the set
          does not contain. On a park, after
          <tt>key_release_grace = 2 s</tt> without the receiver, the sender
          releases everything for that receiver. On a session end, it
          releases everything through one <tt>release_all</tt> path.</t></li>
          <li><t><strong>Deduplication.</strong> The sender rejects an
          <tt>(epoch, input_seq)</tt> 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.</t></li>
        </ol>
        <t>The pressed-set payload is <tt>u32 key_count || u32 keys... ||
        u32 button_count || u32 buttons...</tt>. An empty set is the
        &quot;release everything&quot; heartbeat.</t>
      </section>
    </section>
    <section anchor="timeouts">
      <name>Timeouts and Timers</name>
      <t>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,
      <em>RTT</em> is the smoothed round trip, <em>RTT_min</em> the window
      minimum, and <em>J</em> the jitter estimate.</t>
      <table>
        <name>Protocol timers</name>
        <thead>
          <tr><th>Site</th><th>Rule</th></tr>
        </thead>
        <tbody>
          <tr><td>Object assembly</td><td><tt>3 x RTT + 500 ms</tt></td></tr>
          <tr><td>Report interval (idle)</td><td><tt>clamp(4 x RTT_min, 250 ms, 2 s)</tt></td></tr>
          <tr><td>Prompt report interval</td><td><tt>clamp(RTT_min / 4, 25 ms, 250 ms)</tt></td></tr>
          <tr><td>No-feedback grace</td><td><tt>3 x report_interval + 2 s</tt></td></tr>
          <tr><td>Probe interval</td><td>1 s</td></tr>
          <tr><td>Probe deadline</td><td><tt>2 x RTT + 250 ms</tt>; none before the first RTT measurement</td></tr>
          <tr><td>Idle object</td><td><tt>clamp(2 x RTT, 1000 ms, 3000 ms)</tt></td></tr>
          <tr><td>Input deadline</td><td>5000 ms by default; a deployment may set another value</td></tr>
          <tr><td>Pressed-set heartbeat</td><td><tt>clamp(2 x RTT, 5 s, 30 s)</tt></td></tr>
          <tr><td>Key-release grace after park</td><td>2 s</td></tr>
          <tr><td>Staleness budget</td><td><tt>3 x (report_interval + 1 s)</tt></td></tr>
          <tr><td>Park TTL</td><td><tt>clamp(2 x outage_target + 60 s, 120 s, 900 s)</tt>; 300 s by default</td></tr>
          <tr><td>Resume token TTL</td><td>Advertised in <tt>MediaHelloAck</tt>; 900 s by default</td></tr>
          <tr><td>Reconnect base</td><td><tt>max(500 ms, RTT)</tt></td></tr>
          <tr><td>Reconnect ceiling</td><td>30 s</td></tr>
          <tr><td>Reconnect jitter</td><td>0 to 250 ms</td></tr>
          <tr><td>Write-queue residency</td><td>10 s; a media object older than this is dropped and counted</td></tr>
          <tr><td>Acknowledgement ring</td><td><tt>max(64, ceil(2 x RTT / update_interval) + 8)</tt> updates</td></tr>
        </tbody>
      </table>
      <t>An implementation MUST assert the following arithmetic at start-up
      and in its tests:</t>
      <ul>
        <li><tt>session_idle &gt;= 2 x outage_target + 4 x RTT</tt>;</li>
        <li><tt>park_ttl &gt;= outage_target + max_reconnect_ladder_time</tt>;</li>
        <li><tt>heartbeat x 4 &lt;= session_idle</tt>;</li>
        <li><tt>assembly_timeout &gt;= RTT</tt> and
        <tt>probe_deadline &gt;= RTT</tt>;</li>
        <li>no intermediate hop's idle timeout is below the session's idle
        timeout.</li>
      </ul>
      <t>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.</t>
    </section>

    <section anchor="security">
      <name>Security Considerations</name>

      <section anchor="threat-model">
        <name>Threat Model</name>
        <t>This section follows the guidance of <xref target="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.</t>
        <t>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.</t>
      </section>

      <section anchor="resume-security">
        <name>Resume Tokens</name>
        <t>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.</t>
        <ul>
          <li><t>The token MUST be unforgeable and MUST be bound to the
          session, the receiver, and the sender.</t></li>
          <li><t>It MUST carry a single-use generation that advances on every
          use, so a replay is detectable.</t></li>
          <li><t>It MUST expire, and the expiry MUST be inside the
          authenticated payload, not beside it.</t></li>
          <li><t>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.</t></li>
          <li><t>It MUST NOT be logged, placed in a URL, or sent to any party
          but the issuer.</t></li>
        </ul>
        <t>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.</t>
      </section>

      <section anchor="replay">
        <name>Replay and Injection</name>
        <t>MLP's own identifiers make a replayed object detectable:</t>
        <ul>
          <li><t>The object-id deduplication window rejects a repeated
          <tt>(object_id, fragment_index)</tt> pair.</t></li>
          <li><t>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.</t></li>
          <li><t>The chain epoch only moves forward; an object from an older
          epoch does not reset the receiver's trust.</t></li>
          <li><t>The input sequence is deduplicated over a 4096-entry window
          keyed by <tt>(epoch, input_seq)</tt>.</t></li>
        </ul>
        <t>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.</t>
      </section>

      <section anchor="dos">
        <name>Denial of Service</name>
        <t>Every allocation has a stated bound. The important ones are:</t>
        <table>
          <name>Resource bounds</name>
          <thead>
            <tr><th>Resource</th><th>Bound</th></tr>
          </thead>
          <tbody>
            <tr><td>Open objects per lane</td><td>4</td></tr>
            <tr><td>Bytes held by incomplete objects</td><td>1 MiB</td></tr>
            <tr><td>Header extension</td><td>256 bytes</td></tr>
            <tr><td>Fragments per object</td><td>4096</td></tr>
            <tr><td>Fragment payload</td><td>Carrier cap (65536 or 1150)</td></tr>
            <tr><td>Parts per update</td><td>8 on a stream carrier; 4 on a datagram carrier; 1 under heavy loss</td></tr>
            <tr><td>FEC group</td><td><tt>k</tt> and <tt>n</tt> at most 8</td></tr>
            <tr><td>Sender write queue</td><td><tt>in_flight_cap</tt> objects and 4 MiB of payload</td></tr>
            <tr><td>Receiver input queue</td><td>64 objects and 8 KiB</td></tr>
            <tr><td>Coverage grid</td><td>2048 cells (a larger surface must be downscaled)</td></tr>
          </tbody>
        </table>
        <t>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.</t>
        <t>A sender MUST NOT emit an object above its own
        <tt>max_object_bytes</tt>. 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.</t>
        <t>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.</t>
      </section>

      <section anchor="fec-security">
        <name>Forward Error Correction Integrity</name>
        <t>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.</t>
      </section>

      <section anchor="cc-security">
        <name>Congestion Control Safety</name>
        <t>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.</t>
      </section>

      <section anchor="privacy">
        <name>Privacy Considerations</name>
        <t>This section follows the guidance of <xref target="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.</t>
        <ul>
          <li><t>MLP headers carry no user identifiers. <tt>SEND_EPOCH_MS</tt>
          and the other timestamps are session-relative, not wall-clock, and
          are not comparable across sessions.</t></li>
          <li><t>The media session identifier and the object and update
          identifiers are opaque to the protocol and SHOULD be random or
          otherwise unlinkable across sessions.</t></li>
          <li><t><tt>app_version</tt> in <tt>MediaFeedback</tt> is a
          diagnostic string. It can fingerprint a client; a privacy-sensitive
          deployment SHOULD leave it empty or send a constant.</t></li>
          <li><t>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.</t></li>
          <li><t>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.</t></li>
        </ul>
      </section>
    </section>

    <section anchor="iana">
      <name>IANA Considerations</name>

      <section anchor="media-type">
        <name>Media Type Registration</name>
        <t>This document requests the registration of the following media
        type <xref target="RFC6838"/>.</t>
        <table>
          <name>Media type application/mlp-fragment</name>
          <tbody>
            <tr><th>Type name</th><td>application</td></tr>
            <tr><th>Subtype name</th><td>mlp-fragment</td></tr>
            <tr><th>Required parameters</th><td>None</td></tr>
            <tr><th>Optional parameters</th><td>None</td></tr>
            <tr><th>Encoding considerations</th><td>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.</td></tr>
            <tr><th>Security considerations</th><td>See Section 11 of this document.</td></tr>
            <tr><th>Interoperability considerations</th><td>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.</td></tr>
            <tr><th>Published specification</th><td>This document.</td></tr>
            <tr><th>Applications that use this media type</th><td>Real-time interactive media transports, remote desktop, cloud gaming, and remote support.</td></tr>
            <tr><th>Fragment identifier considerations</th><td>None.</td></tr>
            <tr><th>Additional information</th><td>Magic number: <tt>4d 4c 50 00</tt> at offset 0. File extension: none. Macros: none. Uniform type identifier: none.</td></tr>
            <tr><th>Person and email address to contact for further information</th><td>Vitaly Kuzyaev &lt;vitkuz573@gmail.com&gt;</td></tr>
            <tr><th>Intended usage</th><td>COMMON</td></tr>
            <tr><th>Restrictions on usage</th><td>None.</td></tr>
            <tr><th>Author</th><td>Vitaly Kuzyaev</td></tr>
            <tr><th>Change controller</th><td>IETF</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="alpn">
        <name>TLS ALPN Protocol ID</name>
        <t>This document requests the registration of the following value in
        the &quot;TLS Application-Layer Protocol Negotiation (ALPN) Protocol
        IDs&quot; registry <xref target="RFC7301"/>.</t>
        <table>
          <name>ALPN registration</name>
          <thead>
            <tr><th>Protocol</th><th>Identification sequence</th><th>Reference</th></tr>
          </thead>
          <tbody>
            <tr><td>Media Lane Protocol version 1</td><td><tt>0x6d 0x6c 0x70 0x2d 0x76 0x31</tt> (<tt>mlp-v1</tt>)</td><td>This document</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="websocket-registry">
        <name>WebSocket Subprotocol Name</name>
        <t>This document requests the registration of <tt>mlp-v1</tt> in the
        &quot;WebSocket Subprotocol Name Registry&quot;
        <xref target="RFC6455"/>, with this document as the reference.</t>
      </section>

      <section anchor="registries">
        <name>New Registries</name>
        <t>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 <xref target="RFC8126"/>, and the
        private-use range is reserved for private or experimental use without
        IANA registration.</t>

        <section anchor="class-registry">
          <name>MLP Fragment Classes</name>
          <table>
            <name>MLP Fragment Classes</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>CONTROL</td><td>This document</td></tr>
              <tr><td>1</td><td>CURSOR</td><td>This document</td></tr>
              <tr><td>2</td><td>MEDIA</td><td>This document</td></tr>
              <tr><td>3</td><td>FEEDBACK</td><td>This document</td></tr>
              <tr><td>4</td><td>PATH</td><td>This document</td></tr>
              <tr><td>5-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="tlv-registry-iana">
          <name>MLP Header Extension TLV Types</name>
          <!-- BEGIN TLV IANA -->
        <table>
          <name>Initial MLP Header Extension TLV Types assignments</name>
        <thead>
          <tr><th>Type</th><th>Name</th><th>Reference</th></tr>
        </thead>
        <tbody>
          <tr><td><tt>0x00</tt></td><td>Reserved</td><td>This document</td></tr>
          <tr><td><tt>0x01</tt></td><td><tt>UPDATE_ID</tt></td><td>This document</td></tr>
          <tr><td><tt>0x02</tt></td><td><tt>UPDATE_BASE</tt></td><td>This document</td></tr>
          <tr><td><tt>0x03</tt></td><td><tt>PART</tt></td><td>This document</td></tr>
          <tr><td><tt>0x04</tt></td><td><tt>UPDATE_BYTES</tt></td><td>This document</td></tr>
          <tr><td><tt>0x05</tt></td><td><tt>CHAIN_EPOCH</tt></td><td>This document</td></tr>
          <tr><td><tt>0x06</tt></td><td><tt>REFLECTS_INPUT_SEQ</tt></td><td>This document</td></tr>
          <tr><td><tt>0x07</tt></td><td><tt>SEND_EPOCH_MS</tt></td><td>This document</td></tr>
          <tr><td><tt>0x08</tt></td><td><tt>DEADLINE_EPOCH_MS</tt></td><td>This document</td></tr>
          <tr><td><tt>0x09</tt></td><td><tt>ECHO_OF_OBJECT_ID</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0A</tt></td><td><tt>BUDGET_BYTES</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0B</tt></td><td><tt>PACE_BPS</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0C</tt></td><td><tt>PATH_HINT</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0D</tt></td><td><tt>INPUT_SEQ</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0E</tt></td><td><tt>CELL_COUNT</tt></td><td>This document</td></tr>
          <tr><td><tt>0x0F</tt></td><td><tt>COST_MS</tt></td><td>This document</td></tr>
          <tr><td><tt>0x10</tt></td><td><tt>STREAM_ID</tt></td><td>This document</td></tr>
          <tr><td><tt>0x11</tt></td><td><tt>FEC_GROUP_ID</tt></td><td>This document</td></tr>
          <tr><td><tt>0x12</tt></td><td><tt>FEC_K</tt></td><td>This document</td></tr>
          <tr><td><tt>0x13</tt></td><td><tt>PATH_ID</tt></td><td>This document</td></tr>
          <tr><td><tt>0x14</tt></td><td><tt>FEC_N</tt></td><td>This document</td></tr>
          <tr><td><tt>0x15</tt></td><td><tt>FEC_REPAIR_INDEX</tt></td><td>This document</td></tr>
          <tr><td><tt>0x16-0xEF</tt></td><td>Unassigned</td><td>Specification Required</td></tr>
          <tr><td><tt>0xF0-0xFF</tt></td><td>Experimental</td><td>This document</td></tr>
        </tbody>
        </table>
      <!-- END TLV IANA -->
        </section>

        <section anchor="priority-registry">
          <name>MLP Priority Levels</name>
          <table>
            <name>MLP Priority Levels</name>
            <thead>
              <tr><th>Value</th><th>Use</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>Control and acknowledgements</td><td>This document</td></tr>
              <tr><td>1</td><td>Input</td><td>This document</td></tr>
              <tr><td>2</td><td>Feedback reports and probe echoes</td><td>This document</td></tr>
              <tr><td>3</td><td>Hop reports</td><td>This document</td></tr>
              <tr><td>4</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>5</td><td>Cursor</td><td>This document</td></tr>
              <tr><td>6</td><td>Interactive media</td><td>This document</td></tr>
              <tr><td>7</td><td>Background refresh</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="error-registry">
          <name>MLP Error Codes</name>
          <table>
            <name>MLP Error Codes</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>Reserved</td><td>This document</td></tr>
              <tr><td>1</td><td>BAD_MAGIC</td><td>This document</td></tr>
              <tr><td>2</td><td>UNSUPPORTED_VERSION</td><td>This document</td></tr>
              <tr><td>3</td><td>BAD_CLASS</td><td>This document</td></tr>
              <tr><td>4</td><td>BAD_FLAGS</td><td>This document</td></tr>
              <tr><td>5</td><td>BAD_PRIORITY</td><td>This document</td></tr>
              <tr><td>6</td><td>BAD_FRAGMENT</td><td>This document</td></tr>
              <tr><td>7</td><td>BAD_LENGTH</td><td>This document</td></tr>
              <tr><td>8</td><td>BAD_EXT</td><td>This document</td></tr>
              <tr><td>9</td><td>META_MISMATCH</td><td>This document</td></tr>
              <tr><td>10</td><td>ASSEMBLY_TIMEOUT</td><td>This document</td></tr>
              <tr><td>11</td><td>ASSEMBLY_EVICTED</td><td>This document</td></tr>
              <tr><td>12</td><td>OBJECT_ID_WRAP</td><td>This document</td></tr>
              <tr><td>13</td><td>BODY_INVALID</td><td>This document</td></tr>
              <tr><td>14</td><td>RATE_LIMITED</td><td>This document</td></tr>
              <tr><td>15</td><td>LANE_DISABLED</td><td>This document</td></tr>
              <tr><td>16-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="state-registry">
          <name>MLP Lane States</name>
          <table>
            <name>MLP Lane States</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>STARTING</td><td>This document</td></tr>
              <tr><td>1</td><td>LIVE</td><td>This document</td></tr>
              <tr><td>2</td><td>DEGRADED</td><td>This document</td></tr>
              <tr><td>3</td><td>CONVERGING</td><td>This document</td></tr>
              <tr><td>4</td><td>STALE</td><td>This document</td></tr>
              <tr><td>5</td><td>PARKED</td><td>This document</td></tr>
              <tr><td>6</td><td>DISABLED</td><td>This document</td></tr>
              <tr><td>7</td><td>DECODE_BOUND</td><td>This document</td></tr>
              <tr><td>8</td><td>NO_FEEDBACK</td><td>This document</td></tr>
              <tr><td>9</td><td>MEDIA_UNSUPPORTED</td><td>This document</td></tr>
              <tr><td>10-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="path-registry">
          <name>MLP Media Paths</name>
          <table>
            <name>MLP Media Paths</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>unknown</td><td>This document</td></tr>
              <tr><td>1</td><td>stream</td><td>This document</td></tr>
              <tr><td>2</td><td>dc-direct</td><td>This document</td></tr>
              <tr><td>3</td><td>dc-turn</td><td>This document</td></tr>
              <tr><td>4</td><td>quic</td><td>This document</td></tr>
              <tr><td>5-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="input-kind-registry">
          <name>MLP Input Kinds</name>
          <table>
            <name>MLP Input Kinds</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>pointer_move</td><td>This document</td></tr>
              <tr><td>1</td><td>pointer_button</td><td>This document</td></tr>
              <tr><td>2</td><td>key</td><td>This document</td></tr>
              <tr><td>3</td><td>wheel</td><td>This document</td></tr>
              <tr><td>4</td><td>clipboard</td><td>This document</td></tr>
              <tr><td>5</td><td>release_all</td><td>This document</td></tr>
              <tr><td>6</td><td>pressed_set</td><td>This document</td></tr>
              <tr><td>7-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="close-code-registry">
          <name>MLP Close Codes</name>
          <table>
            <name>MLP Close Codes</name>
            <thead>
              <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>0</td><td>normal</td><td>This document</td></tr>
              <tr><td>1</td><td>server_shutdown</td><td>This document</td></tr>
              <tr><td>2</td><td>policy</td><td>This document</td></tr>
              <tr><td>3</td><td>superseded</td><td>This document</td></tr>
              <tr><td>4</td><td>park</td><td>This document</td></tr>
              <tr><td>5-239</td><td>Unassigned</td><td>Specification Required</td></tr>
              <tr><td>240-255</td><td>Private Use</td><td>This document</td></tr>
            </tbody>
          </table>
        </section>

        <section anchor="resume-reason-registry">
          <name>MLP Resume Rejection Reasons</name>
          <t>This registry holds UTF-8 strings, not integers. The initial
          values are:</t>
          <table>
            <name>MLP Resume Rejection Reasons</name>
            <thead>
              <tr><th>Value</th><th>Reference</th></tr>
            </thead>
            <tbody>
              <tr><td>ok</td><td>This document</td></tr>
              <tr><td>unknown_session</td><td>This document</td></tr>
              <tr><td>token_expired</td><td>This document</td></tr>
              <tr><td>token_invalid</td><td>This document</td></tr>
              <tr><td>peer_mismatch</td><td>This document</td></tr>
              <tr><td>epoch_stale</td><td>This document</td></tr>
              <tr><td>epoch_mismatch</td><td>This document</td></tr>
              <tr><td>park_evicted</td><td>This document</td></tr>
              <tr><td>All other strings</td><td>Specification Required</td></tr>
            </tbody>
          </table>
        </section>
      </section>

      <section anchor="ports">
        <name>Ports</name>
        <t>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.</t>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front><title>Key words for use in RFCs to Indicate Requirement Levels</title>
        <author initials="S." surname="Bradner" fullname="Scott Bradner"><organization/></author>
        <date year="1997" month="March"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front><title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
        <author initials="B." surname="Leiba" fullname="Barry Leiba"><organization/></author>
        <date year="2017" month="May"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
      <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126">
        <front><title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
        <author initials="M." surname="Cotton" fullname="Michelle Cotton"><organization/></author>
        <author initials="B." surname="Leiba" fullname="Barry Leiba"><organization/></author>
        <author initials="T." surname="Narten" fullname="Thomas Narten"><organization/></author>
        <date year="2017" month="June"/>
        </front>
        <seriesInfo name="BCP" value="26"/>
        <seriesInfo name="RFC" value="8126"/>
        <seriesInfo name="DOI" value="10.17487/RFC8126"/>
      </reference>
      <reference anchor="RFC6838" target="https://www.rfc-editor.org/info/rfc6838">
        <front><title>Media Type Specifications and Registration Procedures</title>
        <author initials="N." surname="Freed" fullname="Ned Freed"><organization/></author>
        <author initials="J." surname="Klensin" fullname="John Klensin"><organization/></author>
        <author initials="T." surname="Hansen" fullname="Tony Hansen"><organization/></author>
        <date year="2013" month="January"/>
        </front>
        <seriesInfo name="BCP" value="13"/>
        <seriesInfo name="RFC" value="6838"/>
        <seriesInfo name="DOI" value="10.17487/RFC6838"/>
      </reference>
      <reference anchor="RFC6455" target="https://www.rfc-editor.org/info/rfc6455">
        <front><title>The WebSocket Protocol</title>
        <author initials="I." surname="Fette" fullname="Ian Fette"><organization/></author>
        <author initials="A." surname="Melnikov" fullname="Alexey Melnikov"><organization/></author>
        <date year="2011" month="December"/>
        </front>
        <seriesInfo name="RFC" value="6455"/>
        <seriesInfo name="DOI" value="10.17487/RFC6455"/>
      </reference>
      <reference anchor="RFC7301" target="https://www.rfc-editor.org/info/rfc7301">
        <front><title>Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension</title>
        <author initials="S." surname="Friedl" fullname="Stephan Friedl"><organization/></author>
        <author initials="A." surname="Popov" fullname="Andrei Popov"><organization/></author>
        <author initials="A." surname="Langley" fullname="Adam Langley"><organization/></author>
        <author initials="E." surname="Stephan" fullname="Emile Stephan"><organization/></author>
        <date year="2014" month="July"/>
        </front>
        <seriesInfo name="RFC" value="7301"/>
        <seriesInfo name="DOI" value="10.17487/RFC7301"/>
      </reference>
      <reference anchor="RFC8445" target="https://www.rfc-editor.org/info/rfc8445">
        <front><title>Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal</title>
        <author initials="A." surname="Keranen" fullname="Ari Keranen"><organization/></author>
        <author initials="C." surname="Holmberg" fullname="Christer Holmberg"><organization/></author>
        <author initials="J." surname="Rosenberg" fullname="Jonathan Rosenberg"><organization/></author>
        <date year="2018" month="July"/>
        </front>
        <seriesInfo name="RFC" value="8445"/>
        <seriesInfo name="DOI" value="10.17487/RFC8445"/>
      </reference>
      <reference anchor="RFC8866" target="https://www.rfc-editor.org/info/rfc8866">
        <front><title>SDP: Session Description Protocol</title>
        <author initials="A." surname="Begen" fullname="Ali Begen"><organization/></author>
        <author initials="P." surname="Kyzivat" fullname="Paul Kyzivat"><organization/></author>
        <author initials="C." surname="Perkins" fullname="Colin Perkins"><organization/></author>
        <author initials="M." surname="Handley" fullname="Mark Handley"><organization/></author>
        <date year="2021" month="January"/>
        </front>
        <seriesInfo name="RFC" value="8866"/>
        <seriesInfo name="DOI" value="10.17487/RFC8866"/>
      </reference>
      <reference anchor="RFC8831" target="https://www.rfc-editor.org/info/rfc8831">
        <front><title>WebRTC Data Channels</title>
        <author initials="R." surname="Jesup" fullname="Randell Jesup"><organization/></author>
        <author initials="S." surname="Loreto" fullname="Salvatore Loreto"><organization/></author>
        <author initials="M." surname="Tuxen" fullname="Michael Tuxen"><organization/></author>
        <date year="2021" month="January"/>
        </front>
        <seriesInfo name="RFC" value="8831"/>
        <seriesInfo name="DOI" value="10.17487/RFC8831"/>
      </reference>
      <reference anchor="RFC8832" target="https://www.rfc-editor.org/info/rfc8832">
        <front><title>WebRTC Data Channel Establishment Protocol</title>
        <author initials="R." surname="Jesup" fullname="Randell Jesup"><organization/></author>
        <author initials="S." surname="Loreto" fullname="Salvatore Loreto"><organization/></author>
        <author initials="M." surname="Tuxen" fullname="Michael Tuxen"><organization/></author>
        <date year="2021" month="January"/>
        </front>
        <seriesInfo name="RFC" value="8832"/>
        <seriesInfo name="DOI" value="10.17487/RFC8832"/>
      </reference>
      <reference anchor="RFC9000" target="https://www.rfc-editor.org/info/rfc9000">
        <front><title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
        <author initials="J." surname="Iyengar" fullname="Jana Iyengar"><organization/></author>
        <author initials="M." surname="Thomson" fullname="Martin Thomson"><organization/></author>
        <date year="2021" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9000"/>
        <seriesInfo name="DOI" value="10.17487/RFC9000"/>
      </reference>
      <reference anchor="RFC9001" target="https://www.rfc-editor.org/info/rfc9001">
        <front><title>Using TLS to Secure QUIC</title>
        <author initials="M." surname="Thomson" fullname="Martin Thomson"><organization/></author>
        <author initials="S." surname="Turner" fullname="Sean Turner"><organization/></author>
        <date year="2021" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9001"/>
        <seriesInfo name="DOI" value="10.17487/RFC9001"/>
      </reference>
      <reference anchor="RFC3552" target="https://www.rfc-editor.org/info/rfc3552">
        <front><title>Guidelines for Writing RFC Text on Security Considerations</title>
        <author initials="E." surname="Rescorla" fullname="Eric Rescorla"><organization/></author>
        <author initials="B." surname="Korver" fullname="Brian Korver"><organization/></author>
        <date year="2003" month="July"/>
        </front>
        <seriesInfo name="BCP" value="72"/>
        <seriesInfo name="RFC" value="3552"/>
        <seriesInfo name="DOI" value="10.17487/RFC3552"/>
      </reference>
      <reference anchor="RFC6973" target="https://www.rfc-editor.org/info/rfc6973">
        <front><title>Privacy Considerations for Internet Protocols</title>
        <author initials="A." surname="Cooper" fullname="Alissa Cooper"><organization/></author>
        <author initials="H." surname="Tschofenig" fullname="Hannes Tschofenig"><organization/></author>
        <author initials="B." surname="Aboba" fullname="Bernard Aboba"><organization/></author>
        <author initials="J." surname="Peterson" fullname="Jon Peterson"><organization/></author>
        <author initials="J." surname="Morris" fullname="John Morris"><organization/></author>
        <author initials="M." surname="Hansen" fullname="Marit Hansen"><organization/></author>
        <author initials="R." surname="Smith" fullname="Rhys Smith"><organization/></author>
        <date year="2013" month="July"/>
        </front>
        <seriesInfo name="RFC" value="6973"/>
        <seriesInfo name="DOI" value="10.17487/RFC6973"/>
      </reference>
      <reference anchor="RFC2914" target="https://www.rfc-editor.org/info/rfc2914">
        <front><title>Congestion Control Principles</title>
        <author initials="S." surname="Floyd" fullname="Sally Floyd"><organization/></author>
        <date year="2000" month="September"/>
        </front>
        <seriesInfo name="BCP" value="41"/>
        <seriesInfo name="RFC" value="2914"/>
        <seriesInfo name="DOI" value="10.17487/RFC2914"/>
      </reference>
      <reference anchor="RFC8085" target="https://www.rfc-editor.org/info/rfc8085">
        <front><title>UDP Usage Guidelines</title>
        <author initials="L." surname="Eggert" fullname="Lars Eggert"><organization/></author>
        <author initials="G." surname="Fairhurst" fullname="Godred Fairhurst"><organization/></author>
        <author initials="G." surname="Shepherd" fullname="Greg Shepherd"><organization/></author>
        <date year="2017" month="March"/>
        </front>
        <seriesInfo name="BCP" value="145"/>
        <seriesInfo name="RFC" value="8085"/>
        <seriesInfo name="DOI" value="10.17487/RFC8085"/>
      </reference>
    </references>
    <references>
      <name>Informative References</name>
      <reference anchor="RFC9002" target="https://www.rfc-editor.org/info/rfc9002">
        <front><title>QUIC Loss Detection and Congestion Control</title>
        <author initials="J." surname="Iyengar" fullname="Jana Iyengar"><organization/></author>
        <author initials="I." surname="Swett" fullname="Ian Swett"><organization/></author>
        <date year="2021" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9002"/>
        <seriesInfo name="DOI" value="10.17487/RFC9002"/>
      </reference>
      <reference anchor="RFC9485" target="https://www.rfc-editor.org/info/rfc9485">
        <front><title>qlog: Structured Logging for Network Protocols</title>
        <author initials="R." surname="Marx" fullname="Robin Marx"><organization/></author>
        <author initials="L." surname="Niccolini" fullname="Luca Niccolini"><organization/></author>
        <author initials="M." surname="Seemann" fullname="Marten Seemann"><organization/></author>
        <author initials="L." surname="Pardue" fullname="Lucas Pardue"><organization/></author>
        <date year="2023" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9485"/>
        <seriesInfo name="DOI" value="10.17487/RFC9485"/>
      </reference>
      <reference anchor="RFC7942" target="https://www.rfc-editor.org/info/rfc7942">
        <front><title>Improving Awareness of Running Code: The Implementation Status Section</title>
        <author initials="Y." surname="Sheffer" fullname="Yaron Sheffer"><organization/></author>
        <author initials="A." surname="Farrel" fullname="Adrian Farrel"><organization/></author>
        <date year="2016" month="July"/>
        </front>
        <seriesInfo name="RFC" value="7942"/>
        <seriesInfo name="DOI" value="10.17487/RFC7942"/>
      </reference>
      <reference anchor="RFC8827" target="https://www.rfc-editor.org/info/rfc8827">
        <front><title>WebRTC Security Architecture</title>
        <author initials="E." surname="Rescorla" fullname="Eric Rescorla"><organization/></author>
        <date year="2021" month="January"/>
        </front>
        <seriesInfo name="RFC" value="8827"/>
        <seriesInfo name="DOI" value="10.17487/RFC8827"/>
      </reference>
    </references>
    <section anchor="test-vectors">
      <name>Test Vectors</name>
      <t>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.</t>

      <section anchor="vector-control">
        <name>Minimal CONTROL Fragment</name>
        <t>A CONTROL object with no extension and no payload. The fixed
        header is the whole fragment.</t>
        <artwork type="ascii-art"><![CDATA[
4d 4c 50 00 01 00 00 00 01 00 00 00 00 00 01 00
00 00 00 00 00 00
]]></artwork>
        <table>
          <name>Decoded minimal CONTROL fragment</name>
          <thead>
            <tr><th>Field</th><th>Value</th></tr>
          </thead>
          <tbody>
            <tr><td>magic</td><td><tt>4d 4c 50 00</tt></td></tr>
            <tr><td>version</td><td>1</td></tr>
            <tr><td>class</td><td>0 (CONTROL)</td></tr>
            <tr><td>flags</td><td>0x00</td></tr>
            <tr><td>priority</td><td>0</td></tr>
            <tr><td>object_id</td><td>1</td></tr>
            <tr><td>fragment_index / count</td><td>0 / 1</td></tr>
            <tr><td>payload_len</td><td>0</td></tr>
            <tr><td>header_ext_len</td><td>0</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="vector-media-anchor">
        <name>MEDIA Anchor Fragment</name>
        <t>A self-contained anchor update in one part and one fragment. The
        extension carries the update metadata; the payload is ten zero
        bytes.</t>
        <artwork type="ascii-art"><![CDATA[
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
]]></artwork>
        <table>
          <name>Decoded MEDIA anchor fragment</name>
          <thead>
            <tr><th>Field or TLV</th><th>Value</th></tr>
          </thead>
          <tbody>
            <tr><td>class / flags / priority</td><td>2 (MEDIA) / 0x02 (ANCHOR) / 6</td></tr>
            <tr><td>object_id</td><td>4</td></tr>
            <tr><td>fragment_index / count</td><td>0 / 1</td></tr>
            <tr><td>payload_len</td><td>10</td></tr>
            <tr><td>header_ext_len</td><td>67</td></tr>
            <tr><td>UPDATE_ID</td><td>5</td></tr>
            <tr><td>UPDATE_BASE</td><td>0 (self-contained)</td></tr>
            <tr><td>PART</td><td>index 0, count 1</td></tr>
            <tr><td>UPDATE_BYTES</td><td>10</td></tr>
            <tr><td>CHAIN_EPOCH</td><td>1</td></tr>
            <tr><td>REFLECTS_INPUT_SEQ</td><td>0</td></tr>
            <tr><td>STREAM_ID</td><td>0</td></tr>
            <tr><td>PATH_ID</td><td>0</td></tr>
            <tr><td>SEND_EPOCH_MS</td><td>500</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="vector-media-update">
        <name>MEDIA Update, First Fragment</name>
        <t>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.</t>
        <artwork type="ascii-art"><![CDATA[
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
]]></artwork>
        <table>
          <name>Decoded first fragment</name>
          <thead>
            <tr><th>Field or TLV</th><th>Value</th></tr>
          </thead>
          <tbody>
            <tr><td>class / flags / priority</td><td>2 (MEDIA) / 0x00 / 6</td></tr>
            <tr><td>object_id</td><td>42</td></tr>
            <tr><td>fragment_index / count</td><td>0 / 2</td></tr>
            <tr><td>payload_len</td><td>4</td></tr>
            <tr><td>header_ext_len</td><td>67</td></tr>
            <tr><td>UPDATE_ID</td><td>7</td></tr>
            <tr><td>UPDATE_BASE</td><td>6 (chained)</td></tr>
            <tr><td>PART</td><td>index 1, count 4</td></tr>
            <tr><td>UPDATE_BYTES</td><td>1234</td></tr>
            <tr><td>CHAIN_EPOCH</td><td>3</td></tr>
            <tr><td>REFLECTS_INPUT_SEQ</td><td>99</td></tr>
            <tr><td>STREAM_ID / PATH_ID</td><td>0 / 0</td></tr>
            <tr><td>SEND_EPOCH_MS</td><td>1000</td></tr>
            <tr><td>payload</td><td><tt>01 02 03 04</tt></td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="vector-unknown-tlv">
        <name>Unknown TLV</name>
        <t>A CONTROL fragment whose extension carries one unassigned type,
        <tt>0x7f</tt>, with a four-byte value. A version 1 receiver skips it
        by length and accepts the fragment.</t>
        <artwork type="ascii-art"><![CDATA[
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
]]></artwork>
      </section>

      <section anchor="vector-parity">
        <name>Parity Object</name>
        <t>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.</t>
        <artwork type="ascii-art"><![CDATA[
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
]]></artwork>
        <table>
          <name>Decoded parity object</name>
          <thead>
            <tr><th>Field or TLV</th><th>Value</th></tr>
          </thead>
          <tbody>
            <tr><td>class / flags / priority</td><td>2 (MEDIA) / 0x01 (FIN) / 6</td></tr>
            <tr><td>object_id</td><td>900</td></tr>
            <tr><td>payload_len</td><td>14</td></tr>
            <tr><td>header_ext_len</td><td>70</td></tr>
            <tr><td>FEC_GROUP_ID</td><td>81</td></tr>
            <tr><td>FEC_K</td><td>4</td></tr>
            <tr><td>FEC_N</td><td>1</td></tr>
            <tr><td>FEC_REPAIR_INDEX</td><td>0</td></tr>
            <tr><td>CELL_COUNT</td><td>64</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="vector-input">
        <name>Input Object</name>
        <t>A key object with sequence 1, deadline 5000 ms, no flags, and a
        two-byte payload (<tt>1e 00</tt>).</t>
        <artwork type="ascii-art"><![CDATA[
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
]]></artwork>
        <table>
          <name>Decoded input object</name>
          <thead>
            <tr><th>Field</th><th>Value</th></tr>
          </thead>
          <tbody>
            <tr><td>marker</td><td><tt>input</tt></td></tr>
            <tr><td>input_seq</td><td>1</td></tr>
            <tr><td>deadline_epoch_ms</td><td>5000</td></tr>
            <tr><td>kind</td><td>2 (key)</td></tr>
            <tr><td>flags</td><td>0x00</td></tr>
            <tr><td>payload_len</td><td>2</td></tr>
            <tr><td>payload</td><td><tt>1e 00</tt></td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="vector-ack">
        <name>Bare MediaAck</name>
        <t>A priority-0 <tt>FEEDBACK</tt> body carrying a bare
        <tt>MediaAck</tt>: highest applied update 10, bitmap
        <tt>0b10101</tt> (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.</t>
        <artwork type="ascii-art"><![CDATA[
08 0a 10 15 18 03 20 f0 01 30 01 48 63
]]></artwork>
      </section>

      <section anchor="vector-fec">
        <name>FEC Coefficients</name>
        <t>The Cauchy coefficients <tt>1 / (r XOR (8 + j))</tt> over GF(256)
        with polynomial <tt>0x11D</tt>, for the first rows and columns:</t>
        <table>
          <name>Cauchy coefficients</name>
          <thead>
            <tr><th>Row <tt>r</tt></th><th><tt>j=0</tt></th><th><tt>j=1</tt></th><th><tt>j=2</tt></th><th><tt>j=3</tt></th></tr>
          </thead>
          <tbody>
            <tr><td>0</td><td>0xAD</td><td>0x9D</td><td>0xDD</td><td>0x98</td></tr>
            <tr><td>1</td><td>0x9D</td><td>0xAD</td><td>0x98</td><td>0xDD</td></tr>
            <tr><td>2</td><td>0xDD</td><td>0x98</td><td>0xAD</td><td>0x9D</td></tr>
          </tbody>
        </table>
        <t>For example, <tt>fec_coefficient(1, 0) = 1/9 = 0x9D</tt>.</t>
      </section>
    </section>

    <section anchor="schema">
      <name>Protocol Buffers Schema</name>
      <t>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
      <tt>mlp.proto</tt>; the field numbers are the wire field numbers used by
      Section 6.</t>
      <!-- BEGIN PROTO SCHEMA -->
      <sourcecode type="protobuf"><![CDATA[
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;
}
]]></sourcecode>
      <!-- END PROTO SCHEMA -->
    </section>

    <section anchor="state-machines">
      <name>State Machines</name>
      <t>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.</t>

      <section anchor="session-sm">
        <name>Session</name>
        <artwork type="ascii-art"><![CDATA[
IDLE -> HANDSHAKING -> ACTIVE -> PARKED -> RESUMING -> ACTIVE
ACTIVE -> CLOSING -> CLOSED
]]></artwork>
        <table>
          <name>Session transitions</name>
          <thead>
            <tr><th>From</th><th>Event</th><th>To</th></tr>
          </thead>
          <tbody>
            <tr><td>IDLE</td><td>Handshake complete</td><td>ACTIVE</td></tr>
            <tr><td>ACTIVE</td><td>Park request</td><td>PARKED</td></tr>
            <tr><td>PARKED</td><td>Resume request</td><td>RESUMING</td></tr>
            <tr><td>RESUMING</td><td>Resume accepted</td><td>ACTIVE</td></tr>
            <tr><td>RESUMING</td><td>Resume refused</td><td>PARKED</td></tr>
            <tr><td>ACTIVE</td><td>Close request</td><td>CLOSING</td></tr>
            <tr><td>CLOSING</td><td>Close acknowledged</td><td>CLOSED</td></tr>
            <tr><td>Any</td><td>Fatal error</td><td>CLOSED</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="sender-sm">
        <name>Sender</name>
        <artwork type="ascii-art"><![CDATA[
READY -> ENQUEUING -> PACING -> SENDING -> AWAITING_ACK -> READY
]]></artwork>
        <table>
          <name>Sender transitions</name>
          <thead>
            <tr><th>From</th><th>Event</th><th>To</th></tr>
          </thead>
          <tbody>
            <tr><td>READY</td><td>Update enqueued</td><td>ENQUEUING</td></tr>
            <tr><td>ENQUEUING</td><td>Object admitted</td><td>PACING</td></tr>
            <tr><td>PACING</td><td>Pacer grants tokens</td><td>SENDING</td></tr>
            <tr><td>SENDING</td><td>Fragment emitted</td><td>SENDING or AWAITING_ACK</td></tr>
            <tr><td>AWAITING_ACK</td><td>Acknowledgement applied</td><td>READY</td></tr>
            <tr><td>AWAITING_ACK</td><td>Ack timeout</td><td>SENDING (new whole state)</td></tr>
            <tr><td>SENDING</td><td>State applied</td><td>READY</td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="receiver-sm">
        <name>Receiver</name>
        <artwork type="ascii-art"><![CDATA[
WAITING -> ASSEMBLING -> APPLYING -> ACKING -> WAITING
]]></artwork>
        <table>
          <name>Receiver transitions</name>
          <thead>
            <tr><th>From</th><th>Event</th><th>To</th></tr>
          </thead>
          <tbody>
            <tr><td>WAITING</td><td>First fragment of an object</td><td>ASSEMBLING</td></tr>
            <tr><td>ASSEMBLING</td><td>Object complete</td><td>APPLYING</td></tr>
            <tr><td>ASSEMBLING</td><td>Assembly timeout or eviction</td><td>WAITING</td></tr>
            <tr><td>APPLYING</td><td>Update applied atomically</td><td>ACKING</td></tr>
            <tr><td>ACKING</td><td>Ack emitted</td><td>WAITING</td></tr>
          </tbody>
        </table>
      </section>
    </section>

    <section anchor="rationale">
      <name>Design Rationale</name>
      <t>This appendix records the choices a reader is most likely to
      question. It is informative.</t>
      <dl>
        <dt>Why whole updates rather than per-cell repair:</dt>
        <dd><t>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.</t></dd>
        <dt>Why two lanes:</dt>
        <dd><t>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.</t></dd>
        <dt>Why anchors rather than resets:</dt>
        <dd><t>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.</t></dd>
        <dt>Why loss is counted in the update-id space:</dt>
        <dd><t>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.</t></dd>
        <dt>Why the input path never echoes keys:</dt>
        <dd><t>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.</t></dd>
        <dt>Why version 1 has no negotiation:</dt>
        <dd><t>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.</t></dd>
      </dl>
    </section>

    <section anchor="implementation-status">
      <name>Implementation Status</name>
      <t>This appendix follows the guidance of <xref target="RFC7942"/>. It
      is informative and does not change the specification.</t>
      <t>At the time of writing, the protocol has:</t>
      <ul>
        <li><t>a Rust reference implementation of the sans-IO wire codec, the
        session machines, pacing, FEC, and continuity;</t></li>
        <li><t>a TypeScript browser implementation of the wire codec, the
        receiver machine, resume, and carrier selection;</t></li>
        <li><t>Go, Python, and C implementations of the wire codec, the
        session machines, the FEC kernels, and a host;</t></li>
        <li><t>a committed conformance corpus with wire vectors, session
        scenarios, and a differential gate that runs every implementation
        against the same expected decisions;</t></li>
        <li><t>a deterministic harness that drives both ends over a modelled
        link and checks the invariants;</t></li>
        <li><t>a reproducible performance suite and committed
        measurements, and structured logs compatible with
        <xref target="RFC9485"/>.</t></li>
      </ul>
      <t>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.</t>
      <t>The source repositories are at
      <tt>https://gitlab.com/medialaneprotocol</tt>. 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.</t>
    </section>
  </back>
</rfc>
