Status Draft. Protocol version 1 (sv1) of the Sloppy Voice v2 product
Date 2026-12-04
Depends on 00 (overview and conventions), 15 (calls, leases, data channels, routing, auto-rejoin), 18 (SFrame and MediaAttestation); also refers to 17 (screen share timeline) and 20 (indicator copy)
Decisions used D-008, D-009, D-010, D-012, D-013, D-015, D-021, D-041, D-042, D-043, D-045, D-046, D-047, D-055, D-060, D-064, D-066, D-067, D-094
Owns The voice-dc/1 media profile (frame message and route header); the audio_loss kind of 15's call.media_feedback; the Opus profiles for microphone and application sound; jitter-buffer and concealment requirements; voice activation, open mic and push-to-talk behaviour, including the D-012 transmit gate in the audio engine and the TalkState it exports; game-sound handling and ducking; the audio clock; receiver lease enforcement; the AudioStats diagnostic counters

Conformance and status

This document is normative unless a section or paragraph says it is informative. Examples are informative unless the text says otherwise; where an example and the normative text disagree, the normative text wins (00 §1.3). The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals.

Binary grammars use ABNF (RFC 5234) in which each terminal value is one octet, so %x10 is the single octet 0x10 and 2OCTET is two octets. All multi-octet integers are unsigned and big-endian (network byte order).

Conformance classes (00 §1.5, D-066) are affected as follows:

Class What it must implement from this document
Server (its relay) §4 frame validation for forwarding (§4.9.2), §8.1 per-recipient delivery and inbound caps. A relay never decodes, decrypts or mixes audio.
SFU-capable server As Server. Audio carried in sfu-rtp/1 follows 17; the Opus profile of §5.2 still applies to its content.
Full client (desktop, mobile) Everything in §4 to §13.
Web client As Full client, with the platform allowances in §5.7, §6.1, §11.1 and §12.1.
Bot client Media is optional. A bot that sends audio MUST meet §4, §5, §7.5, §8 and §12.3. For a bot, intent (§7.3) is true while the bot chooses to send, and the TalkState and other user-interface parts of §7 (indicators, muted return) don't apply. A bot that plays, records or otherwise consumes received audio MUST meet §9 and §12.
Push gateway Nothing.

This document defines no event types, HTTP endpoints or error codes. It has no area in 00 §7.5. It defines one payload kind, audio_loss (§4.7), of 15's call.media_feedback control message, whose kinds 15 delegates to 16 and 17 (15 §6.6, §16.2), and no other kind. Everything else it defines travels as binary frame messages on the sv-audio data channel that 15 sets up, or stays inside the client's audio engine. Problems detected here are silent drops counted in AudioStats (§13); they are never shown as warnings (00 §4.12.5).

1. Scope

This document specifies how voice and other sound are captured, encoded, framed, routed per recipient, buffered, concealed, mixed and played in a Sloppy Voice call, in every security mode. It carries over the old project's proven voice design (brief §5): 20 ms Opus frames on WebRTC data channels, a relay that checks each recipient separately, an adaptive jitter buffer from 60 ms to 180 ms that never holds audio longer than 200 ms, 60 ms of concealment before fading to silence, voice activation with 60 ms to start and 600 ms to stop, push-to-talk that never sends audio from before the press or after the release, optional game-sound ducking, and bounded authority enforced by the audio engine on its own clock.

In scope:

  • the voice-dc/1 frame message with its cleartext route header (participant index, source, stream generation, sequence number, timestamp, flags), which is the SFrame metadata in secure calls, and the audio_loss receiver feedback (§4);
  • the Opus profiles for the microphone (source 0) and for screen or application sound (source 2), including sample rate, frame size, bitrate ranges, in-band FEC, DTX, and constant bitrate in secure calls (§5);
  • capture processing: echo cancellation, noise suppression, gain control, and capture of application sound (§6);
  • voice activation, open mic and push-to-talk, the transmit gate that implements D-012 inside the audio engine, the muted return of voice-activation and open-mic users, and the TalkState the engine exports to the user interface (§7);
  • per-recipient delivery through the relay (§8);
  • the jitter buffer, packet-loss concealment, and treating undecryptable frames as lost (§9);
  • game sound and ducking (§10);
  • the audio clock, the control-plane clock and the wall clock, which timers use which, and the voice and presentation timelines (§11);
  • receiver lease enforcement (§12) and the audio diagnostic counters (§13).

Out of scope (owner in parentheses):

  • call objects, joining, leaving, VoiceLease, lease snapshots and lease ticks (call.tick), the RelayTicket, {relayUrl}/connect, the data-channel layout, the control-channel messages (including relay.subscribe and the call.media_feedback envelope), routing, SFU signalling, call.epoch_ready and call.epoch_switch, the auto-rejoin state machine and timers, Move voice here, Mute for everyone, ringing and the diagnostics upload endpoint (15);
  • SFrame key derivation, the KID layout and joinNonce, SFrame application rules, the replay window, MediaAttestation (18);
  • the video-dc/1 and sfu-rtp/1 profiles, screen-video capture and the audio–video synchronisation of the presentation timeline (17);
  • the copy and presentation of the talk, mute and reconnect indicators (20);
  • relay internals and the relay-control interface (21).

2. Terminology

This document uses the terms of 00 §2 exactly (Call, Participant, pid, VoiceLease, Lease tick, Bounded authority, Media profile, SFrame, MediaAttestation, Auto-rejoin, Move voice here, Talk indicator). It adds these terms, which are local to audio:

Term Definition
Source One media source of a participant, identified by sourceId (00 HP-5, 18): 0 microphone, 1 screen video, 2 screen or application sound, 3 webcam, 4–15 reserved. This document handles sources 0 and 2 (the audio sources).
Media process One running instance of a client's call media engine for one call. It starts at call join, at every rejoin (planned or unplanned), and whenever the engine is restarted (for example after a crash) (00 HP-5, 18 §4.3). Each media process has one joinNonce (18) and one stream generation.
Stream generation (gen) A 12-bit value that identifies the media process within a participant's sources (§4.5.1).
Stream The sequence of frames of one (pid, sourceId, gen). Sequence numbers and timestamps are defined per stream. In a secure call a stream is the frames of one (pid, sourceId, joinNonce), with joinNonce taken from the SFrame KID (18 §4.5, §9.8); its gen is the low 12 bits of that joinNonce.
Frame One voice-dc/1 frame message: route header plus the payload carrying exactly one Opus packet (plain in insecure calls, SFrame-protected in secure calls).
Route header The first 12 octets of a frame message (§4.3). It is never encrypted. In secure calls it is the SFrame metadata, so it is authenticated.
Talkspurt A run of frames of one stream sent without interruption by the transmit gate, from a frame flagged S (start) to a frame flagged E (end).
Transmit gate The audio-engine function that decides, sample by sample, whether captured microphone audio may be encoded and sent (§7.3).
Intent Whether the user wants to be heard now: PTT held, or voice detected, or open mic, and not muted (§7.3).
Ability Whether the client can deliver audio now: a route is up, the client's own lease covers audio, media keys are ready (secure calls) and the capture works: able for the microphone, ableShare for shared sound (§7.3).
TalkState The state the audio engine exports to the user interface to drive the talk and mute indicators (§7.10).
Audio clock The monotonic clock on which the audio engine makes every timing decision, including lease expiry (§11.1, 00 §7.7).
Control-plane clock The client's ordinary monotonic clock that 15 uses for its own timers (rejoin schedule, relay keepalives, diagnostics samples) (§11.2). Never used for audio timing.
Wall clock UTC system time only, used for display, logs and signed-object validity, never for any timer (§11.2).
Voice timeline The low-latency playout timeline for microphone audio (source 0) of all participants (§11.4).
Presentation timeline The playout timeline shared by a participant's screen video and its screen or application sound (sources 1 and 2), defined by 17 (§11.4).
Playout deadline The audio-clock instant at which a frame's first sample must be rendered (§9.3).
Concealment run A continuous period during which a stream's playout is filled by FEC or Opus packet-loss concealment instead of received frames (§9.4).
Coverage Whether a sender's audio is covered by a lease tick: its pid is in the audio list of the newest accepted tick, and that tick is fresh (§12.2).
Ducking Lowering the playout gain of application sound (source 2) while someone speaks (§10).

3. Pipeline overview (informative)

 SENDER (one participant, one media process)

  mic ──► capture ──► AEC / NS / AGC ──► VAD ──► transmit gate ──► Opus encoder ──► [SFrame encrypt, secure only] ──► frame message
          (§6)          (§6)            (§7.6)    (§7.3, D-012)     (§5.1)            (18, route header = metadata)       (§4.3)
                                                    ▲                                                                       │
                     PTT key, mute, mode ───────────┤                                                                       │
                     route up, own lease, keys ─────┘                                                                       │
                                                                                                                            ▼
  app/game sound ──► loopback capture (excludes call audio) ──► silence gate ──► Opus encoder (§5.2) ──► [SFrame] ──►  send to the relay (§8.1)
                     (share gate, §7.3)                                                                                one copy per frame (D-094)
 RELAY (§8.1, 15 §4.5)
   validate ─► lease and subscription checks (15) ─► per-recipient queues, drop instead of queue ─► forward unchanged bytes

 RECEIVER (§9, §12)
   frame ─► validate route header ─► duplicate check ─► [secure: SFrame decrypt + replay check; fail = lost, no state change]
         ─► record sequence number, update stream state ─► jitter buffer per stream ─►
   at playout deadline (audio clock): coverage check (§12) ─► Opus decode / FEC / PLC ≤ 60 ms, then 20 ms fade ─►
   per-participant gain ─► ducking of source 2 (§10) ─► mix ─► limiter ─► speaker
                                                       └─► echo-canceller reference (§6.1)

As in the old project, one encoded 20 ms Opus frame is produced once, protected once (secure calls), and sent as one copy to the hosting server's relay, which forwards the identical bytes to every listener (§8, 15 §4.5). Clients never send media to each other directly (D-094). Insecure calls use the same framing with no SFrame and no MediaAttestation (00 HP-5, D-021).

4. The voice-dc/1 profile

voice-dc/1 is the mandatory audio media profile (D-045, 00 §7.8). Every server's relay and every Full and Web client MUST implement it.

4.1 Transport assumptions

voice-dc/1 messages travel on the audio data channel (sv-audio, 15 §6.4) of a participant's WebRTC connection to the relay. 15 owns the data-channel layout, labels and negotiation. This document relies on these properties of the audio data channel, which 15 provides:

  1. It is an SCTP data channel over DTLS (RFC 8831), separate from the reliable control channel (sv-control) and from the video channel.
  2. It is unordered with maxRetransmits = 0 (partially reliable, no retransmission), so a late frame is lost rather than delayed.
  3. Each data-channel message carries exactly one voice-dc/1 message. Messages are never concatenated or split by the application.
  4. A message of 1,100 octets (§4.8) is always deliverable; 15 §6.3 requires an SDP max-message-size of at least 65,536.

Rationale: audio that arrives late is useless, and retransmission on an ordered channel would cause head-of-line blocking that delays every later frame. The old project used the same unreliable data-channel design.

Receiver feedback about audio (§4.7) doesn't travel on the audio data channel. It is a control-channel message on sv-control (15 §6.5).

4.2 Message types

The first octet of every voice-dc/1 message is vt: the high 4 bits are the profile version, which MUST be 1, and the low 4 bits are the message type.

vt Type Name Direction Section
0x10 0 Frame Sender to relay, relay to listener §4.3
0x11–0x1F 1–15 Reserved — Senders MUST NOT send them. Receivers and relays MUST drop them silently.
any other — Other versions — Receivers and relays MUST drop them silently.

The frame is the only voice-dc/1 message type in version 1.

A future incompatible format is a new profile (voice-dc/2), negotiated as a feature (00 §7.8), not a new version value inside voice-dc/1.

4.3 Frame message (type 0)

  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
 +-------+-------+---------------+-------------------------------+
 |ver = 1|type=0 |     flags     |              pid              |
 +-------+-------+---------------+-------------------------------+
 |sourceId |          gen        |            sequence           |
 | (4 bits)|        (12 bits)    |                               |
 +-------------------------------+-------------------------------+
 |                           timestamp                           |
 +---------------------------------------------------------------+
 |                                                               |
 :   payload: one Opus packet (insecure) or the SFrame            :
 :   ciphertext of one Opus packet (secure)                       :
 |                                                               |
 +---------------------------------------------------------------+

The first 12 octets are the route header.

Octets Field Type Meaning Constraints
0 vt uint8 Version and type MUST be 0x10.
1 flags uint8 Frame flags (§4.4) Reserved bits MUST be sent as 0.
2–3 pid uint16 The sender's participant index in this call (00 §7.6, assigned by 15) MUST equal the sender's own pid.
4–5 (high 4 bits) sourceId 4 bits The audio source: 0 microphone, 2 screen or application sound Only 0 and 2 are valid in voice-dc/1. 1 and 3 are video (17). 4–15 are reserved.
4–5 (low 12 bits) gen 12 bits Stream generation (§4.5.1) Constant for the life of the media process.
6–7 sequence uint16 Per-stream message counter (§4.5.2) Wraps modulo 2^16.
8–11 timestamp uint32 Sampling instant of the first sample in the packet, 48 kHz units (§4.5.3, 00 §7.7) Wraps modulo 2^32.
12– payload octets §4.6 At least 1 octet. Message total at most 1,100 octets (§4.8).

4.4 Flags

Bit (mask) Name Meaning
7 (0x80) C (ciphertext) 1: the payload is an SFrame ciphertext. 0: the payload is a plain Opus packet. It MUST be 1 in a secure call and 0 in an insecure call (SM-11).
6 (0x40) S (start) This frame is the first of a talkspurt (§7.4). The receiver re-anchors playout on it (§9.3).
5 (0x20) E (end) This frame is the last of a talkspurt. After it, the receiver plays silence for this stream without concealment (§9.4).
4 (0x10) D (DTX) The Opus encoder produced this frame while in discontinuous transmission: a DTX packet or a comfort-noise update, carrying no speech (§5.4). After it, missing frames are comfort noise, not loss (§9.4). Only microphone frames in open-mic mode carry D.
3–0 (0x0F) reserved Senders MUST send 0. Receivers MUST ignore them. Relays MUST forward them unchanged.

A frame MAY carry both S and E (a talkspurt of one frame, for example a very short PTT tap). A frame with D MUST NOT carry S or E.

Rationale: the C flag lets relays and receivers drop a frame whose protection doesn't match the call's mode before trying to decode it, so a modified client can't inject plain audio into a secure call. It is authenticated in secure calls, so a relay can't flip it. S and E let receivers tell a deliberate end of speech from packet loss, which avoids 60 ms of synthetic concealment after every release of push-to-talk. D does the same for the pauses of an open-mic speaker: without it, a receiver can only recognise DTX after the next packet arrives, which is too late for its playout deadline.

4.5 Streams, generations, sequence numbers and timestamps

4.5.1 Stream generation

At the start of every media process, the client chooses a fresh 32-bit joinNonce with a cryptographically secure generator (00 §7.15). 18 uses it in the SFrame KID in secure calls. The client MUST do this in insecure calls too, where it is used only here. The stream generation is

gen = joinNonce mod 4096        (the low 12 bits of joinNonce)

All sources of one media process carry the same gen. A client MUST choose a joinNonce whose gen differs from the gen of the media process it most recently ran in the same call (whenever that started) and of every media process it started in the same call within the last 60 s; if a draw collides, it draws again. Redrawing on 1 value in 4,096 leaves joinNonce unpredictable, as 18 §4.3 requires.

gen values have no order. A receiver tells streams apart by gen and tracks which values it has retired (§9.1). In a secure call a receiver MUST drop a frame whose gen differs from the low 12 bits of the joinNonce in the frame's SFrame KID (18).

Rationale: in insecure calls there is no KID, so receivers need some cleartext signal that a participant's media restarted (after a rejoin or crash) so they discard the old stream's state instead of treating the new timestamps as a huge jump. Deriving gen from joinNonce costs nothing and gives secure receivers an extra consistency check. Excluding recent values, including the process just replaced, which may be hours old, stops a restart from going unnoticed when two random draws happen to share their low 12 bits.

4.5.2 Sequence number

  • sequence starts at 0 for each stream and increases by 1, modulo 2^16, for every frame message the sender creates for that stream. An encoder output that isn't sent (a DTX output suppressed under §5.4) creates no frame message and consumes no sequence number.
  • The same frame sent on several paths (to both relays during a planned relay migration, 15 §6.9) carries the same sequence; it is one frame (§8.2).
  • A sender MUST NOT reuse a sequence number within a stream before it has wrapped. At 50 frames per second, a 16-bit sequence wraps every 21 minutes 50.72 seconds, so receivers MUST extend it to 64 bits using serial-number arithmetic (RFC 1982): a received value is interpreted as the extended value closest to the highest extended value seen so far. In a secure call, "seen" means received in a frame that decrypted successfully (§9.1).
  • Gaps in sequence signal loss. Gaps in timestamp without gaps in sequence signal that nothing was sent (DTX, silence gating or a closed transmit gate), not loss.

4.5.3 Timestamp

  • Each media process has one reference instant T0 on the sender's audio clock, taken when the media process starts. For every source of that media process, timestamp = (number of 48 kHz sample periods from T0 to the capture instant of the packet's first sample) mod 2^32.
  • The timestamp clock is 48 kHz whatever the Opus internal bandwidth (RFC 7587 §4.1 uses the same convention). A 20 ms packet advances it by 960.
  • The timestamp keeps advancing while nothing is sent, because it measures capture time, not frames sent. After a gap, the first frame's timestamp reflects the real time elapsed.
  • Video timestamps of the same media process are counted from the same T0 at 90 kHz (17), so a receiver can map a participant's source-2 audio onto its screen video without extra signalling.
  • At 48 kHz a 32-bit timestamp wraps after 24 h 51 min 18.2 s. There is no call length limit (D-013), so receivers MUST compare timestamps with serial-number arithmetic and MUST NOT assume a gap of more than 2^31 periods (about 12.4 h) is meaningful; the S flag re-anchors playout after any gap (§9.3).

Rationale: random initial values (RFC 3550 practice) protect SRTP against known-plaintext attacks. They add nothing here: SFrame uses its own counter, and the route header is authenticated metadata. A shared zero point lets 17 synchronise screen sound with screen video directly.

4.6 Payload

Insecure call (C = 0). The payload is exactly one Opus packet as defined in RFC 6716 §3, starting with its TOC octet. It is never empty.

Secure call (C = 1). The payload is the SFrame ciphertext (RFC 9605 §4.2: SFrame header, encrypted data and authentication tag) of exactly one Opus packet, produced as 18 specifies:

  • the plaintext is the Opus packet;
  • the SFrame metadata is the 12-octet route header of this frame, exactly as sent (octets 0–11);
  • the KID's sourceId MUST equal the route header's sourceId, the KID's leaf index MUST be the leaf of the sender's device in the context's MLS group, and the KID's joinNonce low 12 bits MUST equal gen.

The frame is encrypted once and the identical message bytes are sent on every path, so MediaAttestation hashes (18) are the same whichever path a receiver used.

Rationale: authenticating the route header means a relay can't move one participant's audio to another pid, change a source, re-flag a frame or alter its timing information without the frame failing decryption.

Proposed decision: in a secure call, a received frame changes no receiver state (stream creation, gen succession, the duplicate record, the highest sequence number, the timing values of §9.2, S, E and D handling, re-anchoring) until its SFrame authentication succeeds (§9.1). Rationale: the route header is readable and writable by any relay; letting unauthenticated copies change state would let a relay silence a secure call with one forged frame, including the genuine copies that reach the receiver through the other relay during a planned relay migration (15 §6.9).

4.7 Loss reports: the audio_loss feedback kind

A listener reports what it is receiving from each audio stream, so the sender can tune Opus in-band FEC (§5.3). The report is a call.media_feedback control message (15 §6.5, §6.6) whose d.kind is audio_loss. 15 owns the message envelope (t, from, to, d), its forwarding and its general rate limits. The reporter is from (set by the relay) and the reported sender is to. This document defines the d payload:

Member Type Required Meaning and constraints
kind string Yes audio_loss
sourceId integer Yes 0 or 2: the reported stream of the sender to.
lossPermille integer Yes 0–1,000. Frames missing at the network level (before FEC) over the report interval: floor(1,000 × lost / expected).
latePermille integer Yes 0–1,000. Frames that arrived after their playout deadline (§9.3): floor(1,000 × late / expected).
bufferTargetMs integer Yes 0–1,000. The listener's current jitter-buffer target T (§9.3) for this stream.
received integer Yes 0–65,535. Distinct sequence numbers received in the interval, capped at 65,535.

expected counts sequence numbers from the first to the last received in the interval, so silence isn't counted as loss; lost = expected − received. Receivers ignore unknown members.

Listener rules.

  • A listener SHOULD send one audio_loss per (sender, source) stream every 2 s (audio clock) while that stream is active (§9.4) or became inactive in the last 2 s. It MUST NOT send more than one per second per (sender, source).
  • The report travels through the relay, on the listener's sv-control channel (15 §6.5).

Sender rules.

  • A sender ignores an audio_loss whose sourceId isn't a source it is sending, whose values are out of range, or whose from isn't in the listeners list of its newest fresh lease tick (§12.3).
  • A sender uses at most one report per second per (from, sourceId); later ones in the same second are ignored.
  • Reports are hints within the bounds of §5.3. They are protected hop by hop (DTLS) only, in every mode, and carry no content or keys.

Example (also the test vector for the field rules): listener pid 3 reports on the microphone of pid 7. In the 2 s interval it received 90 of 100 expected sequence numbers, 2 frames were late, and its target is 60 ms.

{ "t": "call.media_feedback", "from": 3, "to": 7,
  "d": { "kind": "audio_loss", "sourceId": 0, "lossPermille": 100, "latePermille": 20,
         "bufferTargetMs": 60, "received": 90 } }

4.8 Size limits

Item Limit
Opus packet (plaintext payload) at most 1,000 octets; senders following §5 produce far less
Frame message, total at most 1,100 octets

Relays and receivers MUST drop frame messages that exceed these limits or that are shorter than 13 octets (the payload is never empty).

4.9 Validation

4.9.1 Receiver validation

A receiver MUST drop a frame silently, and count it in invalidDrops (§13), if any of these holds:

  1. vt isn't 0x10, or the message is outside the §4.8 size limits;
  2. sourceId isn't 0 or 2;
  3. pid is the receiver's own pid, or is neither a participant in the call's roster (15 §2.5.2) nor in the listeners list of the newest accepted lease tick (§12.1);
  4. the C flag doesn't match the call's security mode;
  5. the D flag is set together with S or E, or on a frame with sourceId 2;
  6. (secure call) the SFrame KID's source, leaf or joinNonce doesn't match the route header as §4.6 and 18 §4.5 require.

Item 3 accepts a pid from the newest tick because roster events (call.participant_joined, 15 §15) arrive over the WebSocket and often after a new participant's first frames, which arrive over the relay and are covered by the tick that admitted it.

In a secure call, a frame whose pid isn't in the roster yet can't have its KID leaf checked (18 §4.5 check 4). The receiver holds it undecrypted, as a tentative frame that changes no stream state (§9.1), until the roster entry arrives, but never past the frame's playout deadline (§9.3) and never more than 200 ms. If the roster entry arrives in time, the frame is checked and decrypted; otherwise it is lost, not invalid.

A frame that passes these checks but can't be decrypted is handled as lost (§9.5), not as invalid.

4.9.2 Relay validation

A relay MUST drop a message received on a participant connection's sv-audio channel, and count it, if any of these holds:

  1. vt isn't 0x10, or the message violates §4.8;
  2. the frame's pid isn't the pid bound to that connection by its RelayTicket (15 §4.5 step 2);
  3. sourceId isn't 0 or 2;
  4. the C flag doesn't match the call's mode.

The relay never inspects the payload and never decrypts, decodes, transcodes, mixes or re-times audio. It forwards accepted frame bytes unchanged. The lease and subscription checks are 15's (§8.1, 15 §4.5).

4.10 ABNF

voice-dc-message = frame-msg

frame-msg     = %x10 flags pid src-gen sequence timestamp payload
flags         = OCTET            ; C = 0x80, S = 0x40, E = 0x20, D = 0x10,
                                 ; 0x0F reserved (send 0)
pid           = 2OCTET           ; uint16, big-endian
src-gen       = 2OCTET           ; sourceId (high 4 bits, 0 or 2) | gen (low 12 bits)
sequence      = 2OCTET           ; uint16
timestamp     = 4OCTET           ; uint32, 48 kHz
payload       = 1*1088OCTET      ; Opus packet (C = 0) or SFrame ciphertext (C = 1);
                                 ; whole frame-msg at most 1,100 octets

4.11 Test vectors

The octet strings below were computed from the field values. Opus payload octets in vector 1 are illustrative (a valid TOC octet followed by three arbitrary octets); they aren't a decodable frame.

Vector 1: insecure microphone frame, first of a talkspurt.

Field Value
joinNonce 0x8F3C12A5, so gen = 0x2A5
flags S (0x40)
pid 7
sourceId 0
sequence 0
capture instant 1,000 ms after T0, so timestamp = 48,000 = 0x0000BB80
Opus packet 48 0b e4 55 (TOC 0x48: configuration 9, SILK-only wideband 20 ms, mono, code 0)
10 40 00 07 02 a5 00 00 00 00 bb 80 48 0b e4 55          (16 octets)

Vector 2: route header of a secure application-sound frame, last of a talkspurt, near both wraps. These 12 octets are exactly the SFrame metadata 18 authenticates.

Field Value
flags C and E (0xA0)
pid 513 (0x0201)
sourceId 2
gen 0xFFF
sequence 65,535
timestamp 2^32 − 960 = 4,294,966,336 = 0xFFFFFC40
10 a0 02 01 2f ff ff ff ff ff fc 40                     (12 octets; payload: SFrame ciphertext, see 18 test vectors)

The next frame of this stream has sequence 0 and timestamp 0; extended by serial-number arithmetic they are 65,536 and 4,294,967,296.

Vector 3: insecure open-mic frame starting DTX (§5.4), same media process as vector 1.

Field Value
flags D (0x10)
pid 7
sourceId 0
sequence 1,234 (0x04D2)
capture instant 1,600 ms after T0, so timestamp = 76,800 = 0x00012C00
Opus packet 48 (TOC only: a code-0 packet with a zero-length frame, RFC 6716 §3.2.1)
10 10 00 07 02 a5 04 d2 00 01 2c 00 48                  (13 octets)

Vector 4: the audio_loss example of §4.7.

5. Opus profile

All audio in voice-dc/1 is Opus (RFC 6716). This section fixes encoder settings for senders and decoder duties for receivers. Settings are named after the libopus controls (OPUS_SET_*); an implementation that uses another Opus encoder, such as WebCodecs AudioEncoder with an OpusEncoderConfig, MUST configure the equivalent behaviour.

5.1 Microphone profile (source 0)

Parameter Requirement
Application OPUS_APPLICATION_VOIP
Channels 1 (mono)
Input sample rate 48 kHz into the encoder (capture at another rate is resampled first)
Encoded bandwidth Wideband (8 kHz audio bandwidth, 16 kHz effective sample rate, RFC 6716 §2; OPUS_SET_MAX_BANDWIDTH = OPUS_BANDWIDTH_WIDEBAND) by default. With the user setting "High-quality voice" (default off), up to fullband.
Frame duration 20 ms. Every packet MUST contain exactly 20 ms of audio (one frame, TOC code 0).
Target bitrate 32 kbit/s by default. Allowed range 16–48 kbit/s at wideband; 32–64 kbit/s with "High-quality voice".
Bitrate mode Secure call: constant bitrate (OPUS_SET_VBR = 0), MUST. Insecure call: constrained VBR (OPUS_SET_VBR = 1, OPUS_SET_VBR_CONSTRAINT = 1), SHOULD.
In-band FEC MUST be on (OPUS_SET_INBAND_FEC = 1). Expected loss set as §5.3.
DTX Off in push-to-talk and voice-activation modes; on in open-mic mode (§5.4).
Signal hint OPUS_SIGNAL_VOICE
Complexity 10 on desktop, at least 5 on mobile and web (SHOULD)
Encoder state Reset (OPUS_RESET_STATE) at every gate opening (§7.4), not at the S frame that ends DTX in open mic (§5.4)

Bitrate adaptation. The microphone target bitrate is chosen by the sender and changes only for the sender's own reasons:

  • A sender MAY lower its bitrate, never below 16 kbit/s, when its own uplink is congested, which it detects when the audio data channel's bufferedAmount stays above 2,400 octets for 1 s or more. It SHOULD return to the default within 10 s after bufferedAmount stays at or below 1,200 octets.
  • A sender MUST NOT lower its bitrate because of audio_loss reports (§4.7). They change only the FEC setting (§5.3).

Rationale: wideband at 32 kbit/s with FEC was the old project's proven setting for speech. Keeping one listener's bad network from lowering the bitrate for everybody preserves the old rule that one slow listener never degrades the others.

Proposed decision: Microphone audio in secure calls MUST use constant-bitrate Opus. Rationale: the sizes of variable-bitrate speech packets are known to reveal spoken phrases to an observer, and SFrame doesn't hide sizes; in secure calls the relay must learn only who speaks when (00 §5.4), not what is said.

5.2 Application-sound profile (source 2)

Source 2 carries screen sound, application sound and game sound (one "speak and share" permission covers it, D-015). It uses its own encoder.

Parameter Requirement
Application OPUS_APPLICATION_AUDIO
Channels 2 (stereo) by default; 1 if the captured source is mono
Input sample rate 48 kHz
Encoded bandwidth Fullband
Frame duration 20 ms, one frame per packet
Target bitrate 96 kbit/s stereo or 64 kbit/s mono by default. Allowed range 48–128 kbit/s.
Bitrate mode Secure call: constant bitrate, MUST. Insecure call: VBR, MAY.
In-band FEC SHOULD be on, expected loss as §5.3.
DTX Off. Silence gating (§5.4) replaces it.
Signal hint OPUS_SIGNAL_MUSIC

Source 2 isn't governed by push-to-talk, voice activation or the microphone mute (§7). It is sent exactly while sendShare (§7.3) holds: the user shares sound and the client is able to deliver it, including its own lease covering audio (§12.3), under the live-audio rules of §7.5. Its route header and framing are exactly those of §4.

When source 2 belongs to a screen share that uses the sfu-rtp/1 profile, it travels in that profile as 17 defines (§8.3), and the parameters in this table still apply to the Opus content.

Bots that stream music or other non-microphone sound SHOULD send it as source 2, so listeners get the music profile, per-source volume and ducking (§10).

5.3 In-band FEC and loss reports

The Opus encoder adds low-bit-rate redundancy for the previous frame (LBRR) only when told to expect loss. A sender sets OPUS_SET_PACKET_LOSS_PERC for each of its encoders as follows:

  1. With no audio_loss report (§4.7) accepted for that source in the last 6 s: 10.
  2. Otherwise: let p be the largest lossPermille among the reports for that source accepted in the last 6 s (audio clock), and L = p / 10 (a percentage). The setting is clamp(ceil(L), 5, 25). For example, reports of 51 and 102 give L = 10.2 and a setting of 11.
  3. The setting is re-evaluated at most once per second.

The cap of 25 % bounds what a listener with a very bad network, or a malicious listener, can make the sender spend on redundancy. Because the bitrate stays fixed (§5.1), more redundancy slightly lowers everyone's quality but never raises the sender's bandwidth.

5.4 DTX and silence gating

  • Push-to-talk and voice activation: the transmit gate (§7) already stops sending when the user isn't talking, so Opus DTX is off.

  • Open mic: Opus DTX is on. After each encode the sender reads whether the encoder is in DTX (OPUS_GET_IN_DTX in libopus, or the equivalent): true when the output is a DTX packet (an output of 2 octets or less, which libopus marks as not needing transmission) or a comfort-noise update, which the encoder emits about every 400 ms during silence. Then:

    1. a DTX packet that follows a frame sent without D (or starts the stream) is sent as a frame with the D flag, so receivers learn at once that DTX began;
    2. every other DTX packet is not sent and consumes no sequence number;
    3. a comfort-noise update is sent as a frame with the D flag;
    4. the first frame without D after a frame with D (speech resumed) carries S, so receivers re-anchor (§9.3).

    Frames are numbered consecutively in the order sent; the timestamp jumps across the frames not sent. An encoder that can't run DTX together with constant bitrate sends every frame in secure open-mic calls (DTX off), and none of them carries D.

  • Application sound: the sender SHOULD stop sending source 2 after the captured signal has been digital silence (every sample exactly 0, or below −90 dBFS) for 1 s; the last frame sent carries E. When sound returns it starts a new talkspurt with S. Silence gating MUST NOT be used for source 0, and source 2 never uses DTX or the D flag.

Receivers MUST NOT treat a timestamp gap without a sequence gap as loss (§4.5.2). Missing frames after a frame with D are comfort noise, not loss (§9.4).

Proposed decision: frames produced in Opus DTX carry a D flag in the route header, the first DTX packet is sent and later ones are suppressed. Rationale: receivers must know at the next playout deadline whether a missing frame is a pause or a loss; otherwise every pause of an open-mic speaker is concealed, faded and counted as loss, and implementations disagree.

5.5 Constant bitrate in secure calls

In a secure call every Opus encoder of the sender MUST be in constant-bitrate mode while it is sending. Talkspurt boundaries, DTX in open mic and silence gating still reveal when a person speaks or a shared sound plays; that is accepted metadata (00 §5.4). Packet sizes within a talkspurt MUST NOT vary with the content, apart from the effect of the FEC setting of §5.3, which depends only on audio_loss reports.

5.6 Decoder requirements

  • A receiver runs one Opus decoder per stream (§9.1), at 48 kHz output, with the stream's channel count (a mono decoder MAY be used for a stereo stream if the output is mono).
  • Receivers MUST accept any valid Opus packet, whatever its mode, bandwidth, channel count or TOC code, and MUST derive the packet's duration from its TOC (RFC 6716 §3.1) rather than assume 20 ms. Packets of 10 to 60 ms MUST be handled; others MAY be dropped as invalid.
  • Receivers SHOULD decode LBRR (opus_decode with decode_fec = 1) to recover a missing frame from the next frame, and MUST use Opus packet-loss concealment where FEC isn't available (§9.4).
  • Receivers MUST use an Opus decoder that is robust against malformed input (for example libopus 1.3 or later, which is continuously fuzzed). A packet the decoder rejects is counted as lost.

5.7 Platform notes

  • Web clients MAY use WebCodecs AudioEncoder (codec: "opus", bitrateMode: "constant" in secure calls, opus: {frameDuration: 20000, useinbandfec: true, usedtx, packetlossperc, complexity}) and AudioDecoder, or libopus compiled to WebAssembly, inside an AudioWorklet-driven engine. Where the platform decoder can't decode LBRR, the client MUST still conceal losses with packet-loss concealment; FEC decoding is then not available, which is allowed (it is a SHOULD in §5.6).
  • Mobile clients SHOULD use the platform's voice-processing audio path (on iOS the voice-processing I/O unit with an AVAudioSession in playAndRecord category and voiceChat mode; on Android the VOICE_COMMUNICATION capture source with the platform echo canceller) so the operating system's echo cancellation applies (§6).
  • Bluetooth headsets in hands-free mode deliver 16 kHz or 8 kHz capture. The encoder bandwidth then follows the capture bandwidth; the bitrate MAY be lowered to 24 kbit/s.

6. Capture processing

6.1 Echo cancellation

  • Acoustic echo cancellation (AEC) MUST be on by default for the microphone.
  • The echo canceller's reference signal MUST include everything the client plays out for the call: every participant's microphone audio, application sound (source 2) and the client's own call sounds (join and leave tones). Otherwise remote game sound or music played on speakers would be sent back.
  • A client SHOULD offer an advanced setting to turn AEC off (for example for headphone users who want unprocessed audio). It MUST NOT turn AEC off on its own.
  • Web clients MUST make sure their playout path is covered by the browser's echo canceller. Where audio rendered by an AudioWorklet isn't used as the echo reference on a platform, the client SHOULD route its playout through a path that is (for example, a local loopback RTCPeerConnection feeding an audio element).

6.2 Noise suppression and gain control

  • Noise suppression SHOULD be on by default at a moderate level. The user MAY turn it off (for example to play an instrument).
  • Automatic gain control SHOULD be on by default and SHOULD bring speech to about −20 dBFS RMS, with at most 30 dB of gain. The user MAY turn it off.
  • Voice activation (§7.6) works on the signal after AEC and noise suppression, so it isn't triggered by echo or steady noise.

6.3 Capturing application sound

When a user shares screen or application sound (source 2):

  1. The capture MUST exclude the client's own call playout (other participants' voices and app sound, and call tones). Otherwise listeners would hear themselves and each other echoed. Platforms provide this (for example per-process loopback exclusion on Windows, excludesCurrentProcessAudio with ScreenCaptureKit on macOS, and per-application capture in browsers where supported). Where a platform can capture only the whole system mix including the call's playout, the client MUST NOT offer system sound sharing on that platform.
  2. The client SHOULD capture only the chosen application or screen's sound rather than all system sound, so private sounds (other apps, notifications) aren't shared.
  3. Where the platform allows, the AEC reference SHOULD include the locally shared sound, so the user's microphone doesn't also pick up the game from the user's speakers. Where it doesn't, the client MAY suggest headphones in its share dialog (an informational tip, not a warning).

6.4 Device changes

Changing the input or output device during a call (for example plugging in a headset) MUST NOT change the transmit gate's inputs other than captureOk (or shareCaptureOk for shared sound) while the device switches (§7.2). The echo canceller MUST be reset or reconverged on an output-device change. A device switch is not a talkspurt boundary unless the gate closed during it.

7. Transmit control: push-to-talk, voice activation and open mic

This section is the audio-engine half of D-012 and 00 HP-13, and it is the normative definition of the transmit gate; 15 §10.6 summarises the same gate from the call-control side. 15 owns the call and auto-rejoin state machines that feed it; 20 owns the copy and presentation of the indicators driven by the TalkState it exports.

7.1 Modes

Mode Value How intent is expressed
Push-to-talk ptt The user holds a physical control: a key, mouse or gamepad button, headset button, or an on-screen button.
Voice activation vad The client detects speech (§7.6).
Open mic open_mic Always, while not muted.

The mode is a per-device user setting. Clients SHOULD default to vad; 20 decides the onboarding default. A mode change during a call takes effect at once and is evaluated by the gate like any other input change, subject to the rejoin and lease-block mutes of §7.8.

7.2 Inputs

The transmit gate is a pure function of these inputs. Every input is sampled by the audio engine on the audio clock (§11.1).

Input Type Source Meaning
mode ptt | vad | open_mic User setting §7.1
pttDown boolean Physical control, §7.7 The PTT control is held now, as observed by the client.
userMuted boolean User action, §7.8 (including lease blocks), §7.9 The user's own mute.
muteReason user | rejoin | interruption §7.8, §7.9; user also covers the lease-block mute of §7.8 Why userMuted was last set to true.
vadActive boolean §7.6 Speech detected now. Computed in every mode; used for intent only in vad.
callState joining | connected | reconnecting | migrating | ended Derived from 15's states, table below The call state for this device.
routeUp boolean Defined below A route can deliver a frame to every other listener now.
leaseState covered | excluded | stale §12.3 Whether the client's own pid is in the audio list of a fresh lease tick.
keysOk, keysOkShare boolean 18 §6.3 item 5 Secure call: whether the client may send source 0 (keysOk) or source 2 (keysOkShare) now, exactly as 18 §6.3 item 5 defines it: a send key for the selected epoch, not closed by 18 §6.3 item 4 or stopped by 18 §3.6 item 4 for that source, and no pending key of a verified_blocked contact pin in the sending epoch's roster (07 §16.5). Always true in an insecure call.
captureOk boolean Audio device The microphone is open and delivering samples.
shareActive boolean User action (17 §4) The user is sharing screen or application sound (source 2).
shareCaptureOk boolean Capture of shared sound The shared-sound capture is open and delivering samples.

callState. The audio engine derives callState from 15's client states (15 §10.4) and call events, in this order (the first match wins):

callState When
ended 15's state is ended, or the device has no participation in the call: before a join, after Leave, after a terminal event of 15 §10.1 (including call.ended with any reason other than security_upgraded, group_restarted and server_restart), and when a security_upgraded or group_restarted migration closes the call screen with G1 or G2 (15 §12.1 items 3 and 4, §12.5).
migrating From a call.ended with reason security_upgraded or group_restarted, or a relay.closing with reason call_restarted (15 §6.6, §12.1, §12.5), until the first lease tick of the new call arrives on its relay connection.
reconnecting 15's state is rejoining or waiting, or restoring before the first lease tick of the new relay connection has arrived, after an unexpected drop (15 §10.1), including a call.ended with reason server_restart and an automatic rejoin after a process restart (15 §10.9).
joining From sending a join that isn't a rejoin until the first lease tick arrives on the new relay connection (15 §3.3.4, §6.2).
connected 15's state is in_call, or restoring once the first lease tick of the new relay connection has arrived (send keys that aren't installed yet show in keysOk, not in callState), including every planned migration other than security_upgraded and group_restarted: relay migration (15 §6.9), videoRoute changes, epoch switches, and the device's own MLS resync during a call (15 §12.4, §10.8).

Planned rejoins while connected start a new media process without closing the gate (§7.5 L5, §7.8).

routeUp. routeUp is true when the relay connection is usable, and false otherwise. The relay connection is usable when its sv-audio channel is open; its ICE connection state is neither disconnected nor failed; some message (of any type, on any of its channels) has arrived from the relay within the last 1,500 ms on the audio clock; and the sv-audio channel's bufferedAmount hasn't stayed above 6,000 octets (the L3 threshold, §7.5) for the last 200 ms.

This definition is stricter than 15's declaration that the relay connection has failed (15 §6.7: 5,000 ms without a control message). It changes only the gate and TalkState, not 15's drop detection, so a user whose route has gone quiet is shown as not heard within about 1.5 s rather than 5 s (§15 item 7). Lease ticks normally arrive on the relay every second (15 §4.4), so a usable relay is never silent for 1,500 ms.

Proposed decision: the audio engine's routeUp uses its own 1,500 ms relay-liveness rule (any message from the relay), ICE disconnected, and a 200 ms uplink-backlog rule, in addition to 15's failure detection. Rationale: D-012 says the indicator must never look like it is transmitting when the user isn't heard; 15's 5 s failure threshold would allow several seconds of a false "Talking" indicator.

Rationale for keysOk: as 00 HP-13 item 5 says, under D-042 a sender keeps sending with its previous epoch's key until the switch, so an epoch switch by itself never closes the gate; only a missing sending key does (after a join, a rejoin or an MLS resync, or when 18 §6.3 item 4 closes it), or when a verified contact's changed key blocks sending (18 §6.3 item 5). keysOk and keysOkShare are defined that way.

7.3 The gate function

intent    = (mode = ptt      AND pttDown AND NOT userMuted)
         OR (mode = vad      AND vadActive AND NOT userMuted)
         OR (mode = open_mic AND NOT userMuted)

able      = callState = connected AND routeUp AND leaseState = covered AND keysOk AND captureOk
ableShare = callState = connected AND routeUp AND leaseState = covered AND keysOkShare AND shareCaptureOk

transmit  = intent AND able              (microphone, source 0)
sendShare = shareActive AND ableShare    (shared sound, source 2)

captureOk affects only the microphone and shareCaptureOk only shared sound, so an unplugged microphone never stops shared game sound and a failed sound capture never mutes the user. Push-to-talk, voice activation and mute affect only transmit (§10 item 6).

Requirements:

  1. The audio engine MUST evaluate the gate on every input change and at least once per 10 ms of captured audio.
  2. A microphone sample is eligible for sending only if transmit was true at its capture instant (§7.5 gives the one exception, voice-activation pre-roll). A shared-sound sample is eligible only if sendShare was true at its capture instant.
  3. When transmit becomes true, the first sample sent is the first sample captured at or after that instant. When it becomes false, no sample captured at or after that instant is sent. When the gate closes because intent became false, the last sample sent is the last one captured before that instant (§7.4); when it closes because able became false, captured but unsent samples are discarded (§7.4, §7.5 L4).
  4. A change of pttDown, userMuted or mode MUST take effect within 20 ms of the client observing it.
  5. The gate runs inside the audio engine, on its own thread and clock. A stalled user interface or network thread MUST NOT keep the gate open: if the engine stops receiving fresh lease information, leaseState becomes stale on the audio clock and the gate closes (§12.3).

Push-to-talk follows the physical control (D-012). In ptt mode, transmit is exactly pttDown whenever the client is able and not muted. If PTT is held when ability returns after a rejoin, whether it was held since before the drop or pressed during the outage, transmission starts at that instant with live audio. Releasing PTT at any time, including during an outage, makes intent false, and pressing it again makes it true. A deliberate mute wins over a held PTT control: the user is then shown as not heard because muted (§7.10).

7.4 Talkspurt framing

A talkspurt runs from a gate opening to the next gate closing.

Opening at instant t_open:

  1. The encoder for source 0 is reset (OPUS_RESET_STATE).
  2. Frame boundaries are aligned to the first sample of the talkspurt: the first frame covers the 20 ms starting at that sample, and each later frame the next 20 ms.
  3. The first frame carries the S flag. Its timestamp follows §4.5.3.
  4. The sender SHOULD apply a raised-cosine fade-in over the first 2.5 ms (120 samples at 48 kHz) to avoid a click.

Closing at instant t_close because intent became false (PTT released, muted, voice activation ended, mode change):

  1. The partial frame in progress holds the samples captured from its start until t_close. The sender SHOULD apply a 2.5 ms fade-out ending at t_close, fills the rest of the frame with digital silence, encodes it and sends it with the E flag.
  2. If t_close falls exactly on a frame boundary, the sender sends one frame of digital silence with the E flag. It contains no captured audio.
  3. The sender MUST NOT add any release delay ("hangover") to push-to-talk. Audio captured after the release is never sent (D-012).

Rationale: the owner confirmed that push-to-talk never sends audio captured before the press or after the release (D-012, brief §3 item 12), so there is no release tail, not even an optional one. The 2.5 ms fade and the immediate E frame avoid clicks, and releasing the control always stops transmission at that instant.

Closing because able became false (route lost, call reconnecting or migrating, lease excluded or stale, keys missing, microphone failed):

  1. The partial frame and every captured, unsent sample are discarded. No E frame is sent.
  2. Receivers notice the missing frames and conceal at most 60 ms, then fade out (§9.4).

Switching media process with the gate open (a planned rejoin while connected, §7.5 L5): at a frame boundary, the last frame of the old stream carries E and the next 20 ms of live audio becomes the first frame of the new stream, which carries S. No captured sample is lost or sent twice, and the user's talkspurt continues without a gap at the sender.

Talkspurts of shared sound (source 2) follow the same rules with sendShare in place of transmit, and silence gating (§5.4) in place of intent.

7.5 Live audio only

These rules carry over the old rule that push-to-talk never sends audio captured before the press or after the release, and add D-012's rule that the client never captures audio during an outage to send late. They apply to source 0 and source 2 alike.

  • L1 Nothing from a closed gate. A microphone sample captured while transmit was false MUST NOT be sent, with one exception: in vad mode the talkspurt MAY start with up to 60 ms of pre-roll (the windows that triggered detection, §7.6), and only samples captured while NOT userMuted AND able held MAY be pre-roll. A shared-sound sample captured while sendShare was false MUST NOT be sent.
  • L2 Age limit. A frame MUST NOT be handed to a transport if its first sample was captured more than 100 ms earlier on the audio clock. Such a frame is discarded and counted in framesDroppedSend.
  • L3 No queuing behind congestion. If the audio data channel's bufferedAmount exceeds 6,000 octets, the sender MUST discard new frames for that channel instead of queuing them, until it falls to 1,200 octets or less. Discards are counted in framesDroppedSend.
  • L4 Flush on loss of ability. When able becomes false, the engine MUST discard all captured but unsent microphone audio and the microphone encoder's input. When ableShare becomes false, it MUST do the same for shared sound. The next opening starts a new talkspurt (§7.4).
  • L5 New media process, new streams. A new media process (new joinNonce, gen and T0; sequence numbers from 0) starts at every join and rejoin, planned or unplanned (00 HP-5, 18 §4.3), at the join of the new call after a security_upgraded or group_restarted migration, at the restart after the device's own MLS resync during a call (15 §12.4, 18 §4.3 item 1), and at every engine restart. Nothing captured by a previous media process is sent by a later one. After an unplanned rejoin, a security_upgraded or group_restarted migration, or an engine restart, the gate was closed (L4) and the new media process starts with the next talkspurt. After a planned rejoin while connected (a relay migration), able never became false: the switch happens at a frame boundary with the gate open (§7.4), at the first frame boundary after the rejoin response has been processed, and is inaudible apart from the receivers' re-anchoring (§9.1). After an own MLS resync, callState stays connected, and the switch to the new media process happens at a frame boundary as for a planned rejoin. If the new leaf's send keys aren't installed yet, keysOk is false until they are, so L4 applies and the gate reopens with live audio only.
  • L6 No catch-up. A sender MUST NOT send frames faster than real time to "catch up" after a stall, apart from the pre-roll burst of L1. Frames that missed L2 are lost.

Rationale: an outage on a call is common (a train tunnel, Wi-Fi roaming). If captured audio were queued and sent after reconnecting, listeners would hear old speech late and the speaker would be heard saying things they believe nobody heard. Live-only sending keeps what the user sees, hears and believes consistent.

7.6 Voice activation

  1. Windows. The engine computes the level of the processed microphone signal (after AEC and noise suppression, §6.2) in consecutive 20 ms windows: RMS in dBFS.
  2. Threshold. By default the threshold is automatic: θ = clamp(N + 10 dB, −60 dBFS, −20 dBFS), where N is the 10th percentile of window levels over the last 10 s. A user-adjustable sensitivity setting MAY replace it with a fixed θ between −70 and −10 dBFS. A client MAY use a speech-detection model instead of a level threshold; "above threshold" then means the model classified the window as speech. The timing rules below still apply.
  3. Start. vadActive becomes true at the end of the third consecutive window above θ (60 ms above the threshold).
  4. Stop. While active, vadActive becomes false at the end of the thirtieth consecutive window at or below θ (600 ms below the threshold). The windows during these 600 ms are sent; they are part of the talkspurt.
  5. Pre-roll. On activation the sender SHOULD include the three detecting windows (60 ms) at the start of the talkspurt, subject to L1, so the first syllable isn't clipped. Frame alignment (§7.4) then starts at the first pre-roll sample.
  6. Voice activation keeps running while the user is muted. A client MAY use vadActive while muted to show a gentle "You're muted" hint (20).

Test vector (timing). Windows are numbered from 1; A is above θ, B is at or below. Sequence: B B A A A A B×29 A B×30 B.

Window Event
3–5 Three consecutive A. vadActive = true at the end of window 5. The talkspurt starts with pre-roll windows 3–5.
6 A, talkspurt continues.
7–35 29 B: hangover counting; not yet 30, so still active.
36 A resets the stop counter.
37–66 30 B. vadActive = false at the end of window 66. Windows 3–66 are sent; the last frame carries E.
67 B: nothing sent.

7.7 Observing the push-to-talk control

  • The press instant and release instant are the audio-clock times at which the client observes the press and release events. Event-delivery latency SHOULD be at most 10 ms.
  • Desktop clients SHOULD make the PTT control work while another application (such as a game) has focus. They SHOULD use a platform global-shortcut service that reports both press and release (for example the XDG Desktop Portal GlobalShortcuts interface). Where none exists or it can't report releases or the chosen control (for example a mouse or extra button), a client MAY install a low-level input hook or event tap. It then MUST discard every event other than the chosen control at once, MUST NOT store, log, buffer or transmit any other key or button event, and MUST remove the hook whenever the user isn't in a call or isn't in ptt mode.
  • Where the client can't observe the control (the window or page lost focus without a global mechanism, the platform's service is unavailable, or the page is hidden), the client MUST treat the control as released. When observation resumes, it MUST treat the control as released until it observes a new press, unless the platform reports the current physical state reliably, in which case it uses that state.
  • Key auto-repeat events are otherwise ignored; only transitions count. One exception: while the control is treated as released, an auto-repeat event for it (which the platform delivers only while the key is physically held) counts as a press.
  • On touch screens, the on-screen PTT button is down while the touch is down. A cancelled touch (for example a system gesture) is a release.
  • While the mode is ptt, the user is in a call and the control is unobservable, the client MUST show a persistent hint near the talk indicator saying where push-to-talk works (for example "Push-to-talk works while this window is active"). It is an informational hint, not a security warning (20 owns the copy).

Rationale: "transmit follows the physical control" can only be honoured for a control the client can see. Treating an unseen control as released means the worst case is that the user isn't heard and the indicator says so, never that the user is heard without knowing.

7.8 Auto-rejoin and planned migrations (D-012, D-047)

The audio engine reacts to callState (§7.2) and to 15's planned migrations as follows.

Transition or event Audio engine action
joining (a join that isn't a rejoin) Start a new media process when the join response is processed (L5). If the client is restarting after its own process ended and is rejoining automatically (15 §10.9), the state is reconnecting instead; see that row.
any → reconnecting (unexpected drop) Close the gate (able false) and apply L4. If mode is vad or open_mic and the user isn't muted, set userMuted = true with muteReason = rejoin. In ptt mode change nothing: pttDown keeps being observed. Receiver side: §9.6.
While reconnecting A change of mode to vad or open_mic sets userMuted = true with muteReason = rejoin if the user isn't already muted. A deliberate unmute by the user is honoured.
Automatic rejoin after a process restart (15 §10.9) The engine starts in reconnecting. In vad and open_mic it starts with userMuted = true and muteReason = rejoin.
reconnecting → connected (rejoin completed) The new media process started when the rejoin response was processed (L5). Take leaseState from the rejoin response's tick (§12.1) and later ticks, and keysOk from 18. Re-evaluate the gate: if PTT is held and the client is able, transmit at once with live audio. Voice-activation and open-mic users stay muted until they unmute deliberately.
Planned rejoin while connected: relay migration (15 §6.9) callState stays connected; the gate stays open while routeUp holds. Start a new media process at the next frame boundary with the gate open (§7.4, L5). Send each frame to both relays while 15 §6.9 requires it. Don't change userMuted, mode or anything else. No receiver reset.
The device's own MLS resync during a call (15 §12.4, §10.8) callState stays connected. Start a new media process with a fresh joinNonce at the next frame boundary (L5). keysOk is false until the new leaf's send keys are installed, and L4 applies while it is false. Don't change userMuted, muteReason, mode or PTT observation. No receiver reset.
videoRoute changes and epoch switches (15 §7.3, §9) Nothing changes. These don't change callState, don't close the gate while routeUp stays true, never release a held PTT and never end a talkspurt.
connected → migrating (call.ended with reason security_upgraded or group_restarted, or relay.closing call_restarted; 15 §12.1, §12.5) Close the gate (able false) and apply L4. Don't change userMuted or mode. Receiver side: §9.6.
migrating → connected (the new call's first tick) The new media process started with the new call's join (L5). Re-evaluate the gate with unchanged mute and PTT state.
The newest VoiceLease's audioBlockedBy changes from null to non-null, or the first VoiceLease of a join or rejoin carries a non-null value (15 §4.1, §4.10, §10.6 rule 6) If mode is vad or open_mic and userMuted is false, set userMuted = true with muteReason = user at once, and report it as below. The user interface also sets 20's afterBlock flag (20 §11.3 rule 4). In ptt mode, change nothing.
While the newest VoiceLease's audioBlockedBy is non-null A change of mode to vad or open_mic sets userMuted = true with muteReason = user (and 20's afterBlock) if the user isn't already muted.
any → ended Close the gate, stop capture for this call, discard a muteReason of rejoin or interruption. The next join uses the client's normal starting state (20), unless it is an automatic rejoin after a process restart (row above).

Further rules:

  • Unmuting (a deliberate user action) sets userMuted = false and clears muteReason.
  • Setting the rejoin mute at the start of reconnecting, not at its end, means the mute indicator is already "muted" during the outage and stays so afterwards, so the user never sees a state that contradicts what will happen. Applying it also to a mode change during the outage means no route out of an outage leads to voice activation or open mic transmitting without a deliberate unmute (D-012).
  • Reporting the mute. Every change of userMuted is reported to call control with PATCH …/call/participants/{pid} selfMuted (15 §3.5) while the device has a seat, and every rejoin attempt carries the current userMuted as selfMuted in the join request (15 §3.3.1, §10.6 rule 4), so other participants' mute icons match the engine.
  • Coverage lost and regained only through tick age, with no VoiceLease reporting a block, triggers neither lease-block row. Because the mute is set when the block starts, it doesn't matter whether the tick that restores coverage arrives before or after the call.lease_changed that ends the block.
  • Move voice here (15 §11) ends the old device's call (ended) before the new device joins. The new device starts its own media process; on it, PTT follows that device's own control.

7.9 Operating-system audio interruptions

On platforms where the operating system can take the microphone or audio session away (an incoming cellular call, a voice assistant, another app taking exclusive audio focus):

  1. During the interruption captureOk is false, so the gate is closed (L4), and playout pauses.
  2. When the interruption ends, if it lasted more than 2 s and mode is vad or open_mic and the user wasn't muted, the client sets userMuted = true with muteReason = interruption.
  3. A transient focus loss that only lowers the call's volume (for example a navigation prompt) isn't an interruption.

Proposed decision: After an operating-system audio interruption longer than 2 s, voice-activation and open-mic users come back muted, as after an automatic rejoin. Rationale: it is the same situation as D-012 (the user's attention was elsewhere and nothing physical tells the app they want to talk), so the same rule avoids sending a room the user's surroundings by surprise.

7.10 TalkState

The audio engine exports a TalkState to the user interface: a triple (state, reason, blockedBy). Together with userMuted and muteReason (§7.2), mode, vadActive (§7.6) and the newest VoiceLease's audioBlockedBy (15 §4.1), it is the only input 20 uses for the talk indicator and the mute indicator. The engine MUST update it in the same evaluation that changes the gate, so the exported state never says transmitting while the gate is closed, and MUST deliver every change to the user interface within 100 ms.

state Meaning reason values
off Not in a call on this device. —
transmitting The gate is open and frames are being sent. —
not_heard The user is trying to talk (PTT held, or speech detected in vad, or open_mic unmuted) but isn't being heard. muted, not_allowed, connecting, reconnecting, waiting_for_keys, no_microphone
muted The user is muted and not holding PTT. user, rejoin, interruption
idle Not trying to talk. null, or not_allowed, connecting, reconnecting to let 20 show the call's condition

blockedBy says why the user isn't allowed to talk. It is set only when reason is not_allowed, and is null otherwise. Its value is the audioBlockedBy of the newest VoiceLease the client received (the lease in the join or rejoin response, or call.lease_changed, 15 §4.1, §4.10): no_permission, muted_for_everyone, server_muted, timed_out or other. If that VoiceLease has audio true or none has arrived yet (ticks and call.lease_changed travel separately and may arrive in either order), or its value is unknown, blockedBy is other. 15 §10.6's reasons for condition (c) are these values; there is one enumeration, here.

Evaluation, in order (the first match wins):

1. callState = ended (or no call)                    -> (off, -)
2. transmit                                           -> (transmitting, -)
3. userMuted AND NOT (mode = ptt AND pttDown)        -> (muted, muteReason)
4. wantsToTalk                                        -> (not_heard, R)
5. otherwise                                          -> (idle, I)

wantsToTalk = (mode = ptt AND pttDown)
           OR (mode = vad AND vadActive AND NOT userMuted)
           OR (mode = open_mic AND NOT userMuted)

R = the first that applies of:
      muted            if userMuted
      not_allowed      if leaseState = excluded
      connecting       if callState = joining
      reconnecting     if callState != connected OR NOT routeUp OR leaseState = stale
      waiting_for_keys if NOT keysOk
      no_microphone    if NOT captureOk

I = not_allowed if leaseState = excluded; connecting if callState = joining;
    reconnecting if callState is reconnecting or migrating; otherwise null

Intended presentation (20 owns the copy): not_heard with reconnecting is the D-012 indicator, for example "Reconnecting — you're not being heard"; muted with rejoin is the muted-after-rejoin indicator, for example "You're muted. Tap to unmute"; not_allowed with its blockedBy tells the user whether a moderator muted them, they are timed out or they have no permission to speak (D-015, 15 §4.10). A user-interface component that receives a state or reason value it doesn't know (from a newer audio engine) MUST show it as not_heard with no reason, which never looks like transmitting.

Rationale: making the indicator a function of the same inputs as the gate, evaluated in the same step, is what guarantees D-012's rule that the indicator never looks like it's transmitting when the user isn't heard.

7.11 Gate test vectors

All rows assume captureOk = true unless stated. TalkState is shown as (state, reason), with blockedBy added where it isn't null.

# mode pttDown userMuted (reason) vadActive callState routeUp leaseState keysOk transmit TalkState
1 ptt true false — connected true covered true true (transmitting, −)
2 ptt false false — connected true covered true false (idle, null)
3 ptt true false — reconnecting false stale true false (not_heard, reconnecting)
4 ptt true false — connected true covered false false (not_heard, waiting_for_keys)
5 (newest VoiceLease audioBlockedBy = muted_for_everyone) ptt true false — connected true excluded true false (not_heard, not_allowed, muted_for_everyone)
6 ptt true true (user) — connected true covered true false (not_heard, muted)
7 vad — true (rejoin) true connected true covered true false (muted, rejoin)
8 vad — false true connected true covered true true (transmitting, −)
9 vad — false true migrating (security_upgraded or group_restarted) false covered true false (not_heard, reconnecting)
10 open_mic — false false connected true covered true true (transmitting, −)
11 open_mic — false — connected true stale true false (not_heard, reconnecting)
12 (newest VoiceLease audioBlockedBy = no_permission) ptt false false — connected true excluded true false (idle, not_allowed, no_permission)
13 (captureOk = false) ptt true false — connected true covered true false (not_heard, no_microphone)
14 (relay migration in progress, 15 §6.9) ptt true false — connected true covered true true (transmitting, −)
15 (no message from the relay for 1,500 ms) ptt true false — connected false covered true false (not_heard, reconnecting)

In row 13, if the user is also sharing sound (shareActive and shareCaptureOk true), sendShare is true and the shared sound keeps flowing.

Sequence vector for D-012 (push-to-talk, insecure call): PTT pressed at t = 0 s and held; drop detected at 5.000 s through an immediate signal (the DTLS transport closes, 15 §6.7 rule 2), so routeUp stays true until then (reconnecting); PTT released at 6.000 s and pressed again at 7.000 s; rejoin completes at 8.200 s with a fresh lease covering audio.

Time (s) TalkState Sent
0.000–4.999 (transmitting, −) Frames with captured audio from 0.000; first carries S
5.000 (not_heard, reconnecting) Partial frame discarded; nothing more
6.000 (idle, reconnecting) —
7.000 (not_heard, reconnecting) Nothing; audio captured 7.000–8.199 is never sent
8.200 (transmitting, −) New media process (new gen, sequence 0); first frame starts with the sample captured at 8.200 and carries S

The same scenario in vad mode: at 5.000 s TalkState becomes (muted, rejoin) and stays so after 8.200 s until the user unmutes.

Sequence vector for a mode change during an outage: as above in ptt mode, but at 6.000 s the user switches to vad instead of releasing PTT, and speaks from 7.000 s onwards.

Time (s) userMuted (reason) TalkState Sent
5.000 false (not_heard, reconnecting) Nothing
6.000 true (rejoin), set by the mode change while reconnecting (muted, rejoin) Nothing
8.200 true (rejoin) (muted, rejoin) Nothing, although vadActive is true
9.000 false (the user taps Unmute) (transmitting, −) while speech is detected Frames of live audio from 9.000 (no pre-roll: nothing captured while muted is sent, L1); the first carries S

Sequence vector for a silent network loss (push-to-talk, insecure call; 15 §6.7 rule 2, §10.1). Messages from the relay, including lease ticks, arrive every second, the last one at t = 0.000 s; just after it the network carries nothing (ticks on the WebSocket stop too) until 5.000 s. ICE reports disconnected at 2.000 s. PTT is held throughout. Times are on the client's monotonic clock, taken as aligned with the audio clock.

Time (s) Event routeUp leaseState callState TalkState Sent
0.000 Last relay message and lease tick true covered connected (transmitting, −) Live audio
1.500 1,500 ms without a relay message (§7.2) false covered connected (not_heard, reconnecting) The partial frame and unsent samples are discarded (L4); nothing more
2.000 ICE disconnected false covered connected (not_heard, reconnecting) Nothing
3.000 The newest tick is 3,000 ms old (§12.3) false stale connected (not_heard, reconnecting) Nothing
5.000 5,000 ms without a control-channel message: the relay connection has failed (15 §6.7 rule 2), although the network is back and ICE would return to connected at 5.100. Unexpected drop, t0 = 5.000; the old connection is closed and attempt 1 (rejoin with token) is sent at once false stale reconnecting (not_heard, reconnecting) Nothing
5.300 Rejoin answered 200 with seatRestored: true (the relay hadn't noticed the loss, so the seat went from connected to connecting, 15 §2.6); new media process (L5); connecting to the new relay session false covered (the response's tick, received as of 5.000, §12.1) reconnecting (not_heard, reconnecting) Nothing
5.600 First tick on the new relay connection: the rejoin is complete true covered connected (transmitting, −) New media process (new gen, sequence 0); the first frame starts with the sample captured at 5.600 and carries S

Audio captured from 1.500 to 5.599 is never sent. A relay message processed at 4.999 would have kept the connection; ICE returning to connected alone wouldn't have. In vad mode the rejoin mute is set at 5.000, when the drop is detected (§7.8), not at 1.500: losing routeUp only closes the gate. Other participants see no badge, because the seat never became reconnecting (20 §11.6).

8. Per-recipient delivery

A frame is encoded once, protected once (secure calls), and sent as one copy to the relay, which forwards the identical bytes to each listener. Clients MUST NOT send media to each other directly (D-094): every audio frame travels through the hosting server's relay, or, for the sound of a screen share on the SFU route, through its SFU (§8.3). The routes and their rules come from 15 §7; this section defines how audio frames use them.

8.1 Relay path

Sender. For each frame, the sender sends one copy, a type-0 frame message, on its relay connection's sv-audio channel. During a planned relay migration the sender sends every frame to both relays (15 §6.9).

Relay forwarding. For each frame it accepts (§4.9.2), the relay applies 15 §4.5: the snapshot-freshness and lease checks (the sender's pid in audio of a snapshot received less than 3 s ago, D-046), then forwarding to every session that is in listeners, isn't the sender and, for source 2, has subscribed to (pid, 2) with relay.subscribe (15 §6.6). Source 0 needs no subscription. This section adds how each frame is handed to those recipients.

Per-recipient independence. The relay hands the frame bytes to each eligible recipient's send queue independently. Each recipient has its own queue. The relay MUST NOT let one recipient's state delay or drop a frame for any other recipient. For each recipient separately, the relay MUST drop a frame instead of queuing it when:

  • the recipient's audio data channel has more than 8,000 octets buffered, or
  • the frame could not be sent within 60 ms of the relay receiving it.

Dropped frames are counted per recipient in the relay's metrics (21). The relay SHOULD forward an accepted frame within 5 ms of receiving it. It MUST NOT batch, aggregate, reorder deliberately, delay to smooth jitter, or modify frames. It never sends a frame back to its sender.

Inbound caps. These are the per-source audio budgets that 15 §6.6 leaves to this document, inside the session's maxInboundKbps. The relay enforces them per participant connection, measured on the relay's own monotonic clock:

What Rate Burst
Frame messages, per (connection, sourceId) 55 messages per second 10 messages
Octets of frame messages, per (connection, sourceId) 24,000 octets per second 6,000 octets

Messages over a cap are dropped silently and counted. The caps fit the profiles of §5 (a 128 kbit/s stereo source with SFrame overhead stays under 18,100 octets per second) and allow the voice-activation pre-roll burst (§7.6).

Feedback. audio_loss reports (§4.7) are control-channel messages; the relay forwards them as 15 §6.6 specifies for call.media_feedback.

8.2 Duplicates and route changes

  • Receivers deduplicate per stream by extended sequence number over at least the last 128 sequence numbers.
  • Insecure calls. A sequence number is recorded when its first copy arrives. That copy is used; later copies are dropped and counted in framesDuplicate.
  • Secure calls. A sequence number is recorded only after a copy of it has decrypted successfully (§9.1). A copy that fails decryption records nothing, so a later copy from another path is still processed; an altered or forged copy, from a relay or anywhere else, therefore can't suppress the genuine one. A copy that arrives while an earlier copy of the same sequence number is held undecrypted (§9.5) is kept with it, unless the two are byte-identical, and is tried if the first fails. The SFrame replay check (18 §7) runs after this duplicate check, so a genuine duplicate is counted in framesDuplicate, not in decryptFailures. The duplicate record belongs to the stream as §9.1 defines it, which in a secure call is keyed by joinNonce, so frames decrypted under another joinNonce never mark a genuine stream's sequence numbers as received.
  • Because genuine copies are byte-identical, it doesn't matter which path a frame came from.
  • A route change never changes the transmit gate while routeUp stays true, never ends a talkspurt, and is never shown to the user (00 §4.12.5).
  • The receiver's jitter buffer absorbs the change in delay that a route change causes (§9.3, re-anchoring rule).

8.3 Routes of source 2, subscriptions and the SFU path

  1. Microphone. Source 0 always uses voice-dc/1 through the relay, never the SFU (15 §7.1). It goes to every listener without a subscription (15 §6.6).
  2. Sound of a screen share. Source 2 sent together with the same participant's screen video (source 1) follows the route of that screen video (15 §7.1, 17 §4.7): voice-dc/1 while the call's videoRoute is dc, sfu-rtp/1 while it is sfu.
  3. Sound only. Source 2 sent without screen video from the same participant ("share sound only", or music from a bot, 17 §4.1) always uses voice-dc/1 through the relay, whatever videoRoute is.
  4. Relay subscriptions. A receiving client MUST keep (pid, 2) in its relay.subscribe list (15 §6.6) for every participant whose Participant sources.screenAudio is true and sources.screen false (15 §2.5.2), unless the user set that participant's shared-sound volume to 0 % (§9.7). Source 2 of a screen share is subscribed together with its screen video, as 17 §4.7 item 2 requires.
  5. The SFU path. On sfu-rtp/1, a receiving client MUST route the received source-2 track through its audio engine (for example a MediaStreamAudioSourceNode feeding the engine's AudioWorklet, or an encoded transform feeding the engine's own decoder) so that ducking (§10), per-participant volume and mixing (§9.7) and receiver lease enforcement (§12) apply per render quantum. Jitter buffering and concealment on that path are the platform's and follow 17 (17 §12.9) instead of §9.3 and §9.4. The Opus profile of §5.2 applies to its content.

Proposed decision: source 2 that has no screen video from the same participant always travels as voice-dc/1, even while the call's videoRoute is sfu, and receivers subscribe to it automatically. Rationale: music bots and "share sound only" have no video to stay in sync with, many bots don't implement sfu-rtp/1 (15 §7.2 item 3), and a non-technical listener shouldn't have to open anything to hear shared music. 15 §7.1 and §7.2 item 5 state the same rule.

8.4 Summary

Path Copies the sender makes Who enforces leases Failure isolation Security of the route header
Relay One per frame (to each relay during a planned relay migration); the relay applies leases and, for source 2, receivers' subscriptions (15) Relay (15) and every receiver (§12) Per-recipient queues; one slow listener never affects another Authenticated as SFrame metadata in secure calls; protected only by DTLS to the relay in insecure calls
SFU (source 2 of a screen share only) Per 17 SFU (15) and every receiver Per-viewer layers (17) Per 17 and 18

9. Receiving: jitter buffer and concealment

9.1 Streams

  • A receiver keeps one stream state per (pid, sourceId, gen) (in a secure call, per (pid, sourceId, joinNonce), §2): an Opus decoder, a jitter buffer, the duplicate record (§8.2), the highest extended sequence number, the timing values of §9.2, its activity state (§9.4) and its counters.
  • Authentication first. In an insecure call a frame that passes §4.9.1 updates its stream state on arrival. In a secure call it updates nothing until its SFrame decryption succeeds (§4.6, §9.5): only then is a stream created or switched, its sequence number recorded, the highest sequence number and the timing values updated, and its S, E and D flags acted on. A frame that fails decryption is discarded with no effect on any stream. A frame held undecrypted (an unknown newer epoch, §9.5; a participant not yet in the roster, §4.9.1) is tentative: it occupies its jitter-buffer slot and changes nothing else until it is decrypted.
  • Generations. For each (pid, sourceId) the receiver has at most one current gen and keeps a set of retired gen values for 60 s each. gen values are compared only for equality; they have no order. A frame whose gen is retired is dropped and counted in framesLate. A frame whose gen is neither current nor retired (and, in a secure call, that decrypted successfully) starts a new stream, which becomes current. In a secure call, while the current stream has an attested frame (18 §9.7) and none of the new stream's frames is attested yet, the new stream doesn't become current (18 §9.8 item 6). It is kept beside the current one, both are decoded and mixed, each under 18 §9.8's playback state, and neither gen is retired. The new stream becomes current, with the handover below, when one of its frames is attested. In a secure call, everything this bullet says about gen values (current, retired, new) applies to full joinNonce values instead. A frame that decrypts under a joinNonce with no stream starts a new stream even if its gen equals the current stream's, and the receiver holds at most 4 streams per (pid, sourceId), as 18 §4.5 bounds them.
  • Handover. When a new stream becomes current, the old stream plays out the on-time frames it already holds, up to its frame flagged E or its last buffered frame, and is then discarded and its gen retired. Frames of the old gen that arrive before that are still accepted. The new stream starts at its own first playout deadline (§9.3); if the two overlap for a moment they are mixed. A planned rejoin at the sender (§7.4, L5) therefore causes no audible gap beyond re-anchoring. In a secure call the handover starts only when the Generations bullet above lets the new stream become current, that is, once one of its frames is attested (18 §9.8 item 6).
  • A stream with no frames for 60 s is discarded. All streams of a participant are discarded when the participant leaves the call roster (15).

9.2 Timing values

These values are computed only from frames that updated stream state (§9.1): in a secure call, frames that decrypted successfully; a tentative frame counts from its arrival time once it is decrypted. For each such frame i of a stream:

  • a_i — the audio-clock time (ms) at which the frame arrived;
  • s_i — its extended timestamp divided by 48 (ms of stream time);
  • D_i = a_i − s_i — its relative transit delay (an arbitrary constant offset between the two clocks cancels out below);
  • B — the base delay: the minimum D over the frames received in the last 10 s; at stream start, D of the first frame;
  • T — the target delay (ms), initially 60;
  • O — the stream's current playout offset: frame i is due to be rendered at the audio-clock time p_i = s_i + O, its playout deadline. The ideal offset is O* = B + T.

9.3 Playout and adaptation

Timeliness. A frame is on time if it arrives no later than its playout deadline (a_i ≤ p_i). A frame that arrives later is late: it MUST NOT be played, is counted in framesLate, and is discarded. Late audio is never played, so old speech is never heard late.

Bounds (MUST).

Bound Value
Initial target T for a new stream 60 ms
Maximum target T 180 ms
Minimum target T 60 ms
Maximum time any frame is held between arrival and playout (p_i − a_i) 200 ms

If a frame would be held longer than 200 ms, the receiver MUST shorten the playout offset (by time compression or by discarding the oldest buffered frames) so that no audio is held longer than 200 ms.

Target computation (RECOMMENDED algorithm; the bounds above are mandatory whatever algorithm is used).

  1. Let X_i = D_i − B for the frames of this stream received in the last 3 s of talkspurt time.
  2. If there are at least 25 such frames, let Q be their 95th percentile, and set T = clamp(Q + 20 ms, 60 ms, 180 ms). Otherwise keep the previous T.
  3. If more than 3 % of the frames expected in the last 2 s were late, set T = min(180 ms, max(T, T_prev + 20 ms)).

The 20 ms margin keeps the next frame in the buffer when the current one is due, so in-band FEC can recover a single loss.

Moving the offset.

  • At a talkspurt start (a frame flagged S, the first frame of a stream, or the first frame received while the stream is inactive, §9.4), the receiver sets O = O* directly. The last case covers a talkspurt whose S frame was lost. If the stream had no frames for more than 10 s, B restarts from this frame's D.
  • When O* rises above O, the receiver MUST reach O* within 200 ms, by time-stretching or by inserting concealment at a low-energy point.
  • When O* falls below O, the receiver SHOULD wait until it has stayed at least 10 ms lower for 2 s, then lower O by time compression at no more than 5 % speed-up (50 ms per second), or at once at the next talkspurt start.
  • Re-anchoring after a delay jump: if 10 consecutive frames (200 ms of audio) of a stream arrive late (in a secure call, counting only frames that decrypted successfully), the receiver sets B to the smallest D among them, sets O = O*, and plays from the next arriving frame. This recovers within about 260 ms from a sudden increase in delay, such as a planned relay migration or a change of network on a sender's or receiver's device.

Example. A stream has B = 40 ms and T = 60 ms, so O* = 100 ms. A frame with s_i = 1,000 ms arrives at a_i = 1,052 ms (D = 52, X = 12): it is on time, with deadline 1,100 ms, and is held 48 ms. A frame with s_i = 1,020 ms arriving at 1,125 ms (D = 105, X = 65 > 60) is late and discarded.

Target vectors (X percentile to target):

95th percentile Q of X Target T
25 ms 60 ms (floor)
50 ms 70 ms
100 ms 120 ms
175 ms 180 ms (ceiling)

9.4 Concealment

A stream is active from a frame flagged S (or its first frame, or the first frame received while it is inactive) until a frame flagged E has been played, or until it fades out. While a stream is active and not in DTX (below), at each playout deadline for the next sequence number n:

  1. If frame n is present and decodable, decode it.
  2. Otherwise, if frame n + 1 is present and carries in-band FEC that the decoder can use, decode frame n from it (FEC). Count framesFecRecovered.
  3. Otherwise, run Opus packet-loss concealment for the duration of the missing frame. Count framesConcealed.

Steps 2 and 3 form a concealment run. Rules:

  • Concealment output at full level MUST NOT last more than 60 ms in one run. When a run reaches 60 ms, the receiver fades the stream's output to zero over the next 20 ms of concealment output, then plays silence for that stream, so one run never produces more than 80 ms of synthetic audio. The stream becomes inactive. Count fadeOuts.
  • After a frame flagged E has been played, the receiver plays silence without concealment.
  • DTX. After a frame flagged D (§4.4, §5.4) has been played, the stream is in DTX: at each later playout deadline with no frame present, the receiver renders the decoder's output for a missing packet (opus_decode with no data, which after a DTX packet is comfort noise), not counted as loss or concealment and not limited to 60 ms. A platform decoder that can't produce that output renders silence instead. A received frame flagged D keeps the stream in DTX; a frame without D (it carries S, §5.4) ends DTX and re-anchors. Sequence numbers missing before a frame flagged D are loss as usual.
  • A received frame ends a concealment run. A frame that arrives after a fade-out starts the stream again; the receiver SHOULD fade it in over 5 ms unless it carries S.
  • Concealment is never used to cover a frame that was dropped because the sender isn't covered by a lease (§12) or because of a MediaAttestation failure (§9.5). Those streams fade out within 20 ms.

Rationale: 60 ms of synthetic audio hides ordinary bursts of loss. Longer concealment produces robotic sound and, worse, encourages buffering that would play speech late; silence is the honest output after that.

9.5 Undecryptable, invalid and unattested frames

  • Undecryptable frames are lost. In a secure call a frame whose SFrame decryption fails (authentication failure, a KID whose key the receiver doesn't hold once the hold below has expired, or a frame rejected by 18 §7's counter check or by its freshness check on the capture timestamp) is treated exactly as if it had never arrived: it doesn't enter the jitter buffer, it changes no stream state (§9.1), and concealment covers its slot. Count decryptFailures.
  • Unknown newer epoch. A frame whose KID names an epoch newer than any the receiver holds keys for is kept in its jitter-buffer slot, undecrypted, for up to 200 ms on the audio clock (D-042, 18). If the keys arrive before both that hold and the frame's playout deadline have expired, the frame is decrypted and played. Otherwise it is lost. A frame never waits past its playout deadline because of the hold.
  • Receivers SHOULD decrypt each frame on arrival when the key is available, so that frame n + 1 is ready for FEC recovery of frame n.
  • In secure calls only authenticated plaintext reaches the Opus decoder.
  • Invalid frames (§4.9.1) are dropped and counted in invalidDrops. They don't count as loss in audio_loss reports.
  • MediaAttestation failure. When 18's verification tells the receiver to stop a source (a validly signed attestation that contradicts a frame, or frames unattested for more than 3 s; an attestation with an invalid signature stops nothing, 18 §9.7 step 4), the receiver fades that stream out within 20 ms, discards its buffer, and handles later frames of that source as 18 directs. Count attestationStops. No warning is shown (D-043).
  • Streams 18 doesn't play. A stream in 18's stopped state (18 §9.8), and a stream of a leaf that holds the pending key of a verified_blocked contact pin (18 §9.8 item 5), is decrypted and recorded as 18 requires but never rendered; its output fades out within 20 ms. Only 18 §9.8 stops count in attestationStops.
  • Decoder rejection. A payload the Opus decoder rejects is lost.

9.6 Resets

Event Receiver action
The receiving client's own call enters reconnecting (§7.2) Fade out within 20 ms, and discard, every stream.
The receiving client's own call enters migrating (§7.2) Fade every stream of the old call out within 20 ms and discard every stream state.
A planned rejoin of this client while connected (§7.8) Nothing. Streams continue; frames arrive from both relays during a relay migration and duplicates are dropped (§8.2).
A sender's stream becomes uncovered (§12.2) Fade that sender's audio streams out within 20 ms and discard their buffers. When coverage returns, the next frame starts the stream as at a talkspurt start.
The audio clock advances by more than 500 ms between two render callbacks (a stall or a resume) Discard every frame whose playout deadline has passed; each stream re-anchors at its next frame.
A sender's new media process (gen change) §9.1

9.7 Mixing and output

  • The receiver mixes every active stream into the output: source-0 streams on the voice timeline and source-2 streams on the presentation timeline (§11.4).
  • Each participant has two local volume settings, one for their voice (source 0) and one for their shared sound (source 2), from 0 % to 200 %, default 100 %. A volume of 0 % is a local "mute for me"; it affects only this device.
  • The receiver SHOULD apply a soft limiter so that the mix never clips.
  • A Full or Web client MUST be able to decode and mix at least 8 concurrent source-0 streams and 2 concurrent source-2 streams. When more are active than the device can decode, it MAY stop decoding the source-0 streams with the lowest recent decoded level.
  • Speaking signal. For each participant the engine exports speaking: true while one of that participant's source-0 streams is active and a received (not concealed) frame of it, not flagged D, was rendered within the last 300 ms; false otherwise. A client SHOULD also require that frame's decoded level to be above −50 dBFS, so open-mic background noise sent without DTX isn't shown as speech. 20 uses speaking for speaking indicators. Because uncovered audio is never rendered, a participant muted by a moderator is never shown as speaking.
  • Deafen. If a client offers "Deafen", it sets the playout gain of all call audio to 0 and also mutes the user (userMuted = true, muteReason = user), remembering the userMuted and muteReason it had before. Undeafen restores those two values; an unmute while deafened also undeafens. Both changes are reported with selfDeafened and selfMuted (15 §3.5; §7.8 of this document). Jitter buffers and lease checks keep running, so undeafening is immediate.

10. Game sound and ducking

Game sound is application sound shared as source 2 (§5.2, §6.3). Ducking is a listener-side feature: each listener decides whether shared sound gets quieter while people talk.

  1. Setting. "Lower shared sound while people talk", per device, with a level from 0 % to 100 % (the gain applied to source 2 while ducked). The default is on at 50 % (−6 dB), subject to open question OQ-16-1.
  2. Trigger. Ducking is engaged while the speaking signal (§9.7) is true for any remote participant. A client MAY also duck while the local user is transmitting (a separate setting, default off).
  3. Envelope. On trigger the source-2 gain reaches the ducked level within 50 ms. After the last speaker stops, the gain stays ducked for 500 ms, then returns to the listener's volume over 300 ms. Changes are smooth ramps, never steps.
  4. Scope. Ducking applies to every source-2 stream, including that of a participant who is talking over their own game.
  5. Senders never duck. A sender MUST NOT attenuate its own source 2 because its microphone is active; the choice belongs to each listener.
  6. Independence from the microphone controls. Source 2 isn't affected by the sender's push-to-talk, voice activation or mute. The user starts and stops sharing sound with the share controls (17). Mute for everyone (15) removes the person from the lease audio list, which silences both source 0 and source 2 and leaves video running, as in the old design.

Rationale: game sound and voice compete for the listener's attention. A listener-side setting lets each person choose, and doesn't force a lower-quality stream on listeners who don't want ducking.

11. Clocks

11.1 The audio clock

The audio clock is the clock on which the audio engine makes every timing decision in this document, including lease expiry (00 §7.7).

  1. It is monotonic, in milliseconds (fractions allowed). It never goes backwards and isn't affected by changes to the wall clock (NTP steps, manual changes, time zones).
  2. It MUST keep advancing while the device is suspended (asleep), so that a lease tick received before a suspend is stale after the resume. Suitable sources: CLOCK_BOOTTIME on Linux and Android (SystemClock.elapsedRealtimeNanos), mach_continuous_time on Apple platforms, QueryInterruptTimePrecise on Windows (which, unlike the unbiased interrupt time, includes sleep).
  3. Web clients use performance.now(), whose behaviour across a suspend isn't guaranteed. A web client MUST therefore treat any detected suspension (a freeze or resume page lifecycle event, an AudioContext that left the running state, or a gap of more than 1 s between two audio render quanta) as invalidating every lease tick received before it and as a stall (§9.6).
  4. Capture and render instants are mapped onto the audio clock by the engine. Drift between the capture device, the render device and the audio clock is absorbed by resampling and by the jitter buffer.
  5. The audio clock is read by the audio engine itself and by the network thread when it stamps arriving lease ticks and frames. The user-interface thread is never on the path of an audio timing decision. On web clients, where WebSocket and data-channel messages may be delivered on the main thread, §12.1 item 5 bounds the effect of a stalled main thread.

11.2 The control-plane clock and the wall clock

Two other clocks exist on a client, and neither drives any audio timing decision:

  • The control-plane clock is the operating system's ordinary monotonic clock, which 15 uses for its own schedules: auto-rejoin retries, relay keepalives and diagnostics samples (15 §6.7, §10.4). It isn't affected by changes of UTC time.
  • The wall clock is UTC system time only: for display (such as call duration), for diagnostics timestamps and for validity checks of signed objects. No timer, in this document or in 15, runs on the wall clock, and a change of the wall clock MUST NOT affect audio.

11.3 Which timers use which clock

Timer Value Clock Owner
Frame duration 20 ms Audio (capture sample count) 16
Voice-activation windows, start, stop 20 ms, 60 ms, 600 ms Audio 16
PTT press and release instants — Audio 16
Talkspurt fades 2.5 ms Audio (sample count) 16
Sender age limit (L2) 100 ms Audio 16
Jitter target, hold cap, base window, percentile window, decrease delay 60–180 ms, 200 ms, 10 s, 3 s, 2 s Audio 16
Concealment at full level, then fade 60 ms, then 20 ms (80 ms of synthetic audio at most) Audio (sample count) 16
Relay-liveness window and uplink-backlog window for routeUp 1,500 ms, 200 ms Audio 16
Lease-tick freshness 3,000 ms Audio (MUST) 16 (receiver), 15 (snapshots)
Hold for unknown newer epoch 200 ms Audio 18 (value), 16 (use)
Old-key retention, unattested limit 10 s, 3 s Audio (RECOMMENDED) 18
audio_loss interval, FEC re-evaluation, FEC window 2 s, 1 s, 6 s Audio 16
Ducking attack, hold, release 50 ms, 500 ms, 300 ms Audio 16
Speaking signal 300 ms Audio 16
Interruption threshold 2 s Audio 16
Stream idle discard, retired-gen memory 60 s, 60 s Audio 16
Roster wait for a secure frame from an unknown pid 200 ms at most, never past the playout deadline Audio 16
Web main-thread heartbeat and gap threshold (§12.1) 100 ms, 200 ms Audio 16
Relay per-recipient age limit, inbound caps 60 ms, per second Relay's monotonic clock 16
Lease snapshot interval 1 s Hosting server 15
Auto-rejoin retries, seat, rejoin token 0, 1, 2, 4, 8, 15 s then 30 s; 30 s; 60 s Control-plane monotonic (client); server's own clock (seat, token) 15
Diagnostics sample interval 10 s Control-plane monotonic 15

Rationale: the old design enforced lease expiry on the audio engine's own clock so a stalled interface couldn't keep stale audio playing. Putting every media timer on that clock, and requiring it to count sleep, also stops a laptop that wakes from sleep from playing a burst of stale audio under a lease that expired while it slept.

11.4 Voice and presentation timelines

The old design kept two playout timelines so neither waited for the other. v2 keeps them:

  • Voice timeline. Microphone audio (source 0) of all participants, each stream with its own jitter buffer under §9.3. It is never delayed to line up with any video.
  • Presentation timeline. For each participant who shares a screen, the screen video (source 1) and its sound (source 2) share one timeline, synchronised as 17 specifies (the old targets: sound and video within 80 ms of each other, under 500 ms from capture to display). On this timeline 17's playout delay replaces the target bounds of §9.3, the concealment rules of §9.4 still apply on voice-dc/1 (on sfu-rtp/1 the platform's buffering and concealment apply, §8.3), and no source-2 frame is held longer than 500 ms. Source 2 with no screen video from the same participant (for example a music bot) uses the voice-timeline rules of §9.3.

Neither timeline waits for the other: a participant's voice isn't delayed to match their screen, and screen sound isn't held back by the voice jitter buffer.

12. Receiver lease enforcement

Every receiver's audio engine enforces bounded authority itself (00 HP-15, D-046), independently of the relay and the SFU, which enforce the same lease snapshots on every frame they forward (15 §4.5, §4.7). Every audio frame passes through one of them (D-094).

12.1 Receiving lease ticks

A lease tick is a LeaseSnapshot (15 §4.2) delivered to a participant; it carries at least callId, seq, validMs, audio, video and listeners.

  1. Sources. The client accepts ticks from: the sv-control channel of its relay connection; the event WebSocket (call.tick); and the tick in the call join or rejoin response (15 §3.3.3). For a response tick, rxAt (item 4) is the audio-clock time at which the client first sent a join request carrying that request's Idempotency-Key, or, without one, at which it sent this request, not the time the response was processed. A slow or replayed response then can't make an old tick look fresh.
  2. The client accepts ticks from no other source. A tick for another callId is ignored. When the client joins a new call (a switch, a rejoin into a new call, or the new call after security_upgraded, group_restarted or server_restart), it discards all tick state of the old call and starts afresh with the join response's tick (15 §4.4 item 2).
  3. Well-formedness. A tick that breaks 15 §4.2's rules (arrays not in ascending order or with duplicates, or audio or video not a subset of listeners) is not accepted and doesn't count as the newest tick. The client MAY record it as a diagnostic.
  4. Ordering. A tick is accepted only if its seq is greater than the newest accepted seq for the call. The network thread stamps it with rxAt, the audio-clock time of receipt, before any other processing, and hands it to the audio engine without passing through the user-interface thread. A tick whose seq equals the newest accepted one (the same tick arriving on the second path) is a duplicate and MUST NOT refresh rxAt. A tick with a lower seq is ignored. Recovery from a wedged seq (15 §4.4 item 3): when the newest accepted tick K has t − K.rxAt ≥ V, the next tick of the same call that arrives over the event WebSocket is accepted whatever its seq, stamped as above, and becomes the newest accepted tick. Ticks from the relay or a join response never use this exception.
  5. Web clients. Where ticks are delivered on a page's main thread, a stalled main thread would stamp a queued tick late and make it look fresh. A web client therefore MUST either receive the event WebSocket and its relay connection's sv-control channel in a dedicated Worker that stamps ticks there (where the platform allows data channels in Workers), or have the main thread post a heartbeat to the audio engine at least every 100 ms; when a tick arrives after a heartbeat gap of more than 200 ms, its rxAt is the time of the last heartbeat before the gap.
  6. Validity. A tick's validity is V = 3,000 ms, whatever its validMs says (15 §4.2). A different validMs is otherwise ignored; the client MAY record it as a diagnostic.

12.2 Coverage of remote senders

At audio-clock time t, let K be the newest accepted tick. A sender pid is covered for audio if and only if t − K.rxAt < V and pid is in K.audio. This is 15 §4.6's coverage rule for the audio list, applied on the audio clock. The audio list covers both audio sources (0 and 2), so Mute for everyone silences both (D-015).

  1. At render (MUST). Before mixing any output from a stream, the audio engine checks coverage of the stream's sender at that render quantum. Output from an uncovered sender is never rendered; the stream fades out within 20 ms and its buffer is discarded (§9.6).
  2. At arrival (SHOULD). A frame from a sender that isn't covered when it arrives is dropped and counted in leaseDrops.
  3. The check applies on every path (relay and SFU) and in every security mode.
  4. If no tick has been accepted yet in the call, no sender is covered.

Resulting bound. A revocation is pushed at once (15): the next tick omits the sender, and the receiver stops rendering it within one render quantum plus the 20 ms fade after receiving that tick. If that tick is lost and ticks stop arriving, the last tick that covered the sender expires V after it was received. With snapshots every 1 s, the sender is cut within 4 s on every path (00 HP-15). The relay and the SFU enforce the same bound (15 §4.5, §4.7), so a modified client can't extend it while the hosting server is honest.

12.3 The client's own lease

The same newest tick K gives the client's own leaseState (§7.2):

Condition leaseState
No accepted tick, or t − K.rxAt ≥ V stale
Own pid in K.audio covered
Otherwise excluded
  • The microphone (source 0) and shared sound (source 2) are sent only while leaseState is covered (able and ableShare, §7.3).
  • Listening authority. If the newest tick is fresh and the client's own pid isn't in K.listeners, or no tick is fresh, the client MUST stop rendering call audio. The relay and the SFU, for their part, forward nothing to a session outside listeners (15 §4.5, §4.7).
  • The video list is enforced for video sources by 17, on the same clock and with the same freshness rule.

12.4 Where enforcement runs

Coverage checks run inside the audio engine, on the audio clock, in the render path. Lease ticks reach the engine from the network thread directly, stamped on arrival (§12.1). A stalled user interface or a slow control-plane task therefore can't keep a revoked sender audible: when ticks stop reaching the engine, everything expires on the engine's own clock. On a web page whose main thread delivers ticks, a blocked event loop can't either: ticks that were queued behind it are stamped with the last heartbeat before the stall, or in a Worker (§12.1 item 5), so they don't look fresher than they are.

12.5 Test vectors

V = 3,000 ms. The receiver's own pid is 3. Frames come from pid 7 (source 0) unless stated.

t (audio clock, ms) Event Newest accepted tick (seq @ rxAt) Result
0 Tick seq 10, audio [3, 7], listeners [3, 7] received from the relay 10 @ 0 —
500 Frame from 7 10 @ 0 (age 500) Covered: played
1,000 Tick 11, audio [3, 7], from the relay 11 @ 1,000 —
1,040 Tick 11 again, over the WebSocket 11 @ 1,000 (unchanged) Duplicate; rxAt not refreshed
3,999 Frame from 7 11 @ 1,000 (age 2,999) Covered: played
4,000 Frame from 7 11 @ 1,000 (age 3,000) Not covered (age not < 3,000): dropped. Own leaseState = stale.
4,200 Tick 12, audio [3], listeners [3, 7] 12 @ 4,200 Own leaseState = covered
4,210 Frame from 7 12 @ 4,200 7 not in audio: dropped
4,300 Tick 9, audio [3, 7] (an old tick replayed) 12 @ 4,200 Ignored (lower seq)
4,310 Frame from 7 12 @ 4,200 Dropped
4,330 Tick 14 over the WebSocket, audio [3, 9], listeners [3, 7] 12 @ 4,200 Not accepted: audio isn't a subset of listeners (15 §4.2)
4,400 Rejoin response processed, carrying tick 20 (audio [3, 7]); its request was first sent at 1,000 20 @ 1,000 Accepted with rxAt = 1,000 (§12.1 item 1). Age 3,400: no sender covered, own leaseState = stale
4,450 Tick 21, audio [3, 7], from the relay 21 @ 4,450 7 covered again; own leaseState = covered
4,460 Tick 99,999,999, audio [3, 7], listeners [3, 7], from the relay (forged with a huge seq) 99,999,999 @ 4,460 Accepted (higher seq)
5,450 Tick 22 from the relay 99,999,999 @ 4,460 Ignored (lower seq)
5,470 Tick 22 over the WebSocket 99,999,999 @ 4,460 Ignored: the newest tick is only 1,010 ms old
7,460 Tick 24 from the relay 99,999,999 @ 4,460 Ignored: lower seq, and the recovery of item 4 applies only to WebSocket ticks
7,480 Tick 24, audio [3, 7], over the WebSocket 24 @ 7,480 Accepted although its seq is lower: the newest tick was 3,020 ms old (15 §4.4 item 3). 7 covered; own leaseState = covered

13. Diagnostics: AudioStats

The client records an AudioStats object with each diagnostics Sample that 15 records every 10 s and when a call closes (15 §14.1). It travels as the audio member of that Sample, and is uploaded only as 15 §14.2's diagnostics setting allows (20 owns the setting's screen). Counters count events since the previous Sample. AudioStats contains no audio, no content and no key material.

Member Type Required Meaning
mode string Yes ptt, vad or open_mic. Unknown values are kept as text by collectors.
send array of AudioSendStats Yes One entry per audio source the client sent in the interval (may be empty).
recv array of AudioRecvStats Yes One entry per (pid, sourceId) received in the interval (may be empty). At most 64 entries, for the streams with the most frames received; the rest are summed into recvOverflow.
recvOverflow AudioRecvStats without pid and sourceId No Present only when entries were summed into it (more than 64 streams recorded, or the upload bound below). Counters are sums; targetMs, targetMaxMs and holdP95Ms are the maximum over the summed streams.
invalidDrops integer Yes Frames dropped by §4.9.1 before a stream was identified, or as invalid.
captureGlitches integer Yes Capture callbacks that delivered no or partial data.
renderUnderruns integer Yes Render callbacks that had to output silence because the engine was late.
stalls integer Yes Audio-clock jumps of more than 500 ms between render callbacks (§9.6).
transmittingMs integer Yes Time TalkState was transmitting.
notHeardMs integer Yes Time TalkState was not_heard.
interruptions integer Yes Operating-system audio interruptions (§7.9).

Size in uploads. A report body is limited to 64 KiB (15 §14.3). In an uploaded report, only the last 6 Samples carry audio. Each of those carries at most 4 recv entries: the streams with the most framesReceived, with the rest summed into recvOverflow. With 17 §14's limits, a report of 30 Samples then stays under 64 KiB.

AudioSendStats

Member Type Required Meaning
sourceId integer Yes 0 or 2
framesSent integer Yes Frames created and handed to at least one transport
framesDroppedSend integer Yes Frames discarded by L2 or L3 (§7.5)
talkspurts integer Yes Talkspurts started
bitrateKbps integer Yes Current target bitrate
fecLossPerc integer Yes Current OPUS_SET_PACKET_LOSS_PERC
cbr boolean Yes Whether the encoder is in constant-bitrate mode

AudioRecvStats

Member Type Required Meaning
pid integer Yes The sender (0–65535, 00 §7.6)
sourceId integer Yes 0 or 2
framesReceived integer Yes Valid frames received, including duplicates
framesLost integer Yes Sequence numbers never received (network loss)
framesLate integer Yes §9.3; also frames of a retired gen (§9.1)
framesDuplicate integer Yes §8.2
framesFecRecovered integer Yes §9.4
framesConcealed integer Yes §9.4
fadeOuts integer Yes §9.4
decryptFailures integer Yes §9.5 (0 in insecure calls)
leaseDrops integer Yes §12.2
attestationStops integer Yes §9.5
reanchors integer Yes Re-anchorings after a delay jump (§9.3)
targetMs integer Yes Current jitter target T
targetMaxMs integer Yes Largest T in the interval
holdP95Ms integer Yes 95th percentile of p_i − a_i for played frames

Example:

{
  "mode": "ptt",
  "send": [
    { "sourceId": 0, "framesSent": 212, "framesDroppedSend": 0, "talkspurts": 3,
      "bitrateKbps": 32, "fecLossPerc": 10, "cbr": true }
  ],
  "recv": [
    { "pid": 7, "sourceId": 0, "framesReceived": 347, "framesLost": 6, "framesLate": 2,
      "framesDuplicate": 0, "framesFecRecovered": 4, "framesConcealed": 4, "fadeOuts": 0,
      "decryptFailures": 0, "leaseDrops": 0, "attestationStops": 0, "reanchors": 0,
      "targetMs": 60, "targetMaxMs": 80, "holdP95Ms": 58 }
  ],
  "invalidDrops": 0,
  "captureGlitches": 0,
  "renderUnderruns": 1,
  "stalls": 0,
  "transmittingMs": 4240,
  "notHeardMs": 0,
  "interruptions": 0
}

The member names inside AudioStats are defined here; the Sample, the report envelope, its upload, consent and retention belong to 15 (15 §14).

Consistency with 15's Sample. Where 15's Sample has its own audio members, a client computes them from the same counters, so the two never disagree: audioFramesSent is framesSent of source 0; audioFramesReceived is the sum of framesReceived − framesDuplicate over source-0 streams; concealedMs is 20 × the sum of framesFecRecovered + framesConcealed over all streams; lossPermille is floor(1,000 × ΣframesLost / Σ(framesReceived − framesDuplicate + framesLost)) over source-0 streams (0 when the denominator is 0); and jitterBufferMs is the largest targetMs among source-0 streams.

14. Traceability (informative)

Old design (brief §5) or decision v2 rule Section
Data-channel relay forwarding voice frames, not RTP tracks voice-dc/1 on an unordered, non-retransmitting audio data channel §4
Each 20 ms Opus frame encoded (and, on secure paths, protected) once One encode, one SFrame protection, identical bytes on every path §4.6, §8
D-094 all call media through the hosting server's relay or SFU One copy of each frame to the relay, which forwards it to every listener; clients never send media to each other §8
Relay checks each recipient separately; inbound traffic capped per second Per-recipient queues with drop rules; token-bucket inbound caps §8.1
Opus 16 kHz mono, 32 kbit/s, in-band FEC on Microphone profile: wideband, 32 kbit/s, FEC on, plus CBR in secure calls §5.1
Jitter buffer from 60 ms, adapting up to 180 ms, never holding more than 200 ms Same bounds, as MUSTs §9.3
Up to 60 ms filled by FEC or concealment, then fade to silence Same, with a 20 ms fade after the 60 ms §9.4
Voice activation: 20 ms windows, 60 ms to start, 600 ms to stop Same §7.6
PTT never sends audio from before the press or after the release Gate on observed instants; no release tail §7.3, §7.4, §7.7
Optional game-sound ducking to half volume Listener-side ducking at 50 % §10
Two playout timelines (voice; screen video with its sound) Voice and presentation timelines §11.4
Lease expiry enforced on the audio engine's own clock Audio clock, counting suspend; render-path enforcement §11.1, §12
Mute for everyone silences every audio type, leaves video audio lease list covers sources 0 and 2 §10, §12.2
D-012 auto-rejoin with transmit following physical PTT Gate, live-audio rules, TalkState, muted return (also after a mode change during the outage and after a process restart) §7
D-047 planned migrations keep mic and PTT state Planned rejoins keep the gate open and hand over to a new media process at a frame boundary §7.4, §7.8, §9.1
D-015 one "speak and share" permission Lease audio list governs both audio sources §12
D-041, D-042, D-043 media E2EE Route header as SFrame metadata; undecryptable = lost; 200 ms hold; attestation stops §4.6, §9.5
D-046 lease ticks valid 3 s Receiver and own-lease coverage §12

15. Security considerations

  1. Insecure calls give no protection against servers. In an insecure call the hosting server, its relay and its SFU can hear all audio, and can alter, drop or inject frames under any participant's pid; the route header isn't authenticated end to end. Only third parties are kept out, by DTLS (00 §5.1, D-021). Receivers' validation (§4.9.1) protects against malformed input, not against the server.
  2. Secure calls authenticate the route header. The 12-octet route header is the SFrame metadata, so a relay can't move audio to another pid or source, flip the C, S, E or D flags, or change timestamps without decryption failing. The KID consistency checks (§4.6) stop a frame being re-labelled as another participant's. A frame changes no receiver state until it authenticates (§9.1), so forged or altered copies can't start or switch streams, mark sequence numbers as received, shift timing or suppress a genuine copy arriving through the other relay during a planned relay migration (§8.2). A relay can still drop, delay, duplicate and replay frames. Duplicates are removed (§8.2), replays are rejected by the SFrame replay window (18), and delayed frames miss their playout deadline and are discarded (§9.3). A relay therefore can't make old speech play late: no frame is ever played more than 200 ms after it arrives, and a late frame is never played.
  3. Members can forge each other's media keys. SFrame keys come from the MLS group, so any member can derive any sender's key. MediaAttestation (18) bounds a forgery to normally under 1 s, and at most about 3 s per episode and 3 counted episodes per minute per participant and source, plus up to about 3 s per minute excused as route disruptions (00 §10 item 9, 18 §14 item 2). Receivers stop the source silently, without a warning (D-043).
  4. Packet sizes leak speech. With variable bitrate, the sizes of encrypted voice packets reveal spoken phrases (RFC 6562). Secure calls therefore use constant-bitrate Opus for every source (§5.1, §5.5). Talkspurt boundaries, DTX in open mic (including the cleartext D flag and the small DTX packets), silence gating of source 2, speaking timing and audio_loss reports still reveal who speaks when and network quality per participant. This is the accepted metadata of 00 §5.4.
  5. Bounded authority on every path. Receivers enforce leases on the audio clock in the render path (§12), so a stalled user interface or a sleeping laptop can't keep a revoked speaker audible. Every frame also passes through the hosting server's relay or SFU, which enforces the same leases (15 §4.5, §4.7, D-094), so no pair of modified clients can keep a revoked speaker audible between them in a call.
  6. Listening authority. A participant removed from listeners stops rendering (§12.3), and the relay and the SFU stop forwarding frames to it (15 §4.5, §4.7). A modified client can keep rendering frames it already holds, but receives no new ones; in secure calls the MLS removal and key rotation (13, 18) end its ability to decrypt new epochs.
  7. D-012 as a privacy property. The live-audio rules (§7.5) guarantee that audio captured while the user believed they weren't heard (muted, PTT released, during an outage) is never sent later. Treating an unobservable PTT control as released (§7.7), muting voice-activation and open-mic users after an unexpected drop or a long interruption (§7.8, §7.9), and computing TalkState from the same inputs as the gate (§7.10) mean the user is never heard without the indicator saying so. The residual window runs the other way: when a route dies silently, the indicator may show transmitting while frames are lost until routeUp turns false, which happens within 1,500 ms of the last message from the relay (§7.2), plus at most 100 ms to reach the user interface (§7.10). During that window the user isn't heard, which errs on the safe side, and it is far shorter than 15's 5 s failure detection.
  8. Global shortcuts. A client prefers a global-shortcut service that sees only the chosen PTT control. Where it must use a low-level input hook, it discards every other event at once, never stores, logs or transmits one, and removes the hook outside calls and outside ptt mode (§7.7), so PTT support can't become a keylogger.
  9. Shared sound. Capturing application sound can expose private sounds. Clients capture only the chosen application or screen where the platform allows, always exclude the call's own playout, and don't offer whole-system capture where the call's playout can't be excluded (§6.3).
  10. Amplification and resource exhaustion. One copy sent to the relay fans out to every listener, so the relay's inbound caps (§8.1) bound what one participant can make the relay send. Source 2 goes only to receivers that subscribed. audio_loss reports are rate-limited by listeners and senders and can raise a sender's FEC share to at most 25 %, never its bitrate (§5.3). Receivers bound streams per participant, remember retired generations for only 60 s and discard idle streams (§9.1).
  11. Decoder attack surface. Opus decoders parse attacker-controlled input in insecure calls. Size limits (§4.8), a fuzzed decoder (§5.6) and treating rejected packets as lost limit the exposure. In secure calls only authenticated plaintext reaches the decoder (§9.5).
  12. Clock manipulation. No audio timer uses the wall clock or the control-plane clock (§11.2), so changing the system time can't extend a lease or replay old audio. The audio clock counts suspended time, so sleep can't either (§11.1). Lease ticks are stamped when they arrive, a join or rejoin response's tick when its request was first sent, and a web page's stalled main thread can't make a queued tick look fresh (§12.1).
  13. Diagnostics. AudioStats contains counters only, keyed by pid. It tells the hosting server about call quality and timing it can already observe at its relay, and is uploaded only as 15 §14.2's diagnostics setting allows.
  14. Network addresses. Clients never send media to each other directly (D-094), so other call participants never learn a user's IP address from a call; only the hosting server's relay and SFU see it.

16. Open questions

ID Question Recommendation
OQ-16-1 Should game-sound ducking be on by default? The old design made it optional and didn't state a default. On by default at 50 %, as §10 specifies, with a one-tap setting to turn it off. Non-technical users rarely find such settings, and speech intelligibility matters more than game volume in a voice chat.

17. References

17.1 Normative

  • RFC 2119, RFC 8174 — requirement key words
  • RFC 5234 — ABNF
  • RFC 1982 — serial number arithmetic
  • RFC 6716 — Definition of the Opus audio codec
  • RFC 7587 — RTP payload format for Opus (48 kHz timestamp convention, §4.1)
  • RFC 8831 — WebRTC data channels; RFC 8832 — WebRTC data channel establishment protocol; RFC 8841 — SDP offer/answer for SCTP over DTLS (max-message-size)
  • RFC 9605 — Secure Frame (SFrame)
  • RFC 9420 — The Messaging Layer Security protocol
  • W3C WebRTC 1.0; W3C Media Capture and Streams; W3C Web Audio API (AudioWorklet); W3C WebCodecs and its Opus codec registration
  • 00 — Overview, architecture and conventions (§4, §5.4, §7, HP-5, HP-13, HP-15)
  • 15 — Calls: control, leases, routing and continuity
  • 17 — Screen share and webcam
  • 18 — Media end-to-end encryption
  • 20 — Client behaviour and user experience

17.2 Informative

  • RFC 3550 — RTP (sequence number and timestamp practice)
  • RFC 6562 — Guidelines for the use of variable bit rate audio with secure RTP
  • RFC 7874 — WebRTC audio codec and processing requirements
  • RFC 8854 — WebRTC forward error correction requirements
  • C. V. Wright, L. Ballard, S. E. Coull, F. Monrose, G. M. Masson, "Spot me if you can: Uncovering spoken phrases in encrypted VoIP conversations", IEEE Symposium on Security and Privacy, 2008
  • libopus API documentation (encoder and decoder controls, including OPUS_GET_IN_DTX)
  • XDG Desktop Portal, GlobalShortcuts interface (global push-to-talk shortcuts on Linux desktops)
  • spec/DECISIONS.md — decision log
  • The project brief, §5 — the old voice and video design