Architectural Reasons for Omitting Signaling from WebRTC
By Nadia Ferrante
WebRTC does not define a signaling protocol. If you examine RFC 8825, which outlines the WebRTC protocol architecture, you will find descriptions of data channels, DTLS handshakes, SRTP cryptographic contexts, and RTP/RTCP multiplexing. You will not find a wire protocol for discovering endpoints, initiating sessions, or exchanging session parameters.
This omission was not an oversight or an unfinished milestone. The working groups deliberately pushed signaling out of the browser core. Understanding the technical boundaries created by this separation is mandatory if you are designing or troubleshooting low-latency voice infrastructure. When a session fails to establish, the fault almost always sits in the translation layer between your signaling topology and the browser's internal state machine.
What does the JSEP Architecture and State Isolation actually mean?
The boundary between signaling and media transport is formalized in the JavaScript Session Establishment Protocol (JSEP), specified in RFC 8829. JSEP establishes that the browser provides media control mechanisms while the application provides session control policy.
"JSEP does not specify a wire protocol. The format of the signaling messages sent between the browser and the application server, or between application servers, is entirely up to the application." (RFC 8829, Section 1.1)
The decision stems from the failure of earlier telecommunication frameworks. Protocols like SIP (RFC 3261) and H.323 attempted to standardize both the session orchestration layer and the transport negotiation layer. When applied to web environments, these monolithic specifications created massive state machines that were difficult to integrate with existing application databases, access control lists, and asymmetric client-server models. By keeping signaling outside the core specification, the IETF allowed applications to run signaling over arbitrary transports: WebSockets, HTTP/2 Server-Sent Events, Long Polling, or raw TCP sockets.
Offer/Answer State Machine Execution
Under JSEP, the browser's multimedia engine behaves as a deterministic, passive state machine. It does not send network packets to locate a remote peer. Instead, it exposes the local representation of the desired media session through an SDP (Session Description Protocol) blob, which the application must explicitly retrieve, transmit, and inject into the remote peer.
The state machine requires five explicit operations: 1. createOffer: Queries local capabilities (hardware inputs, supported codecs, transport options) and generates an SDP offer describing these capabilities. 2. setLocalDescription: Commits the generated offer or answer to the browser's internal engine, transitioning the peer connection state (e.g., from stable to have-local-offer). 3. Transport of the SDP blob across the application-defined signaling plane. 4. setRemoteDescription: Applies the peer's SDP offer or answer to the local engine, validating codec compatibility and setting up media decoders. 5. createAnswer: If the remote description was an offer, the local engine produces an SDP answer detailing the accepted codecs and transport targets.
If your signaling layer delivers an offer out of sequence—such as delivering a new offer before an in-flight offer has been answered—the engine throws an invalid state error. JSEP does not define how to resolve this glare state over the wire; it merely gives you the mechanisms (such as setLocalDescription({type: "rollback"})) to rewind the local state machine if your application signaling encounters collisions.
Candidate Trickling and Transport Independence
The initial design of SDP assumed that all network parameters were known before the offer was constructed. In modern NAT environments, resolving public IP addresses and relay allocations takes hundreds of milliseconds. If WebRTC had incorporated a synchronous signaling protocol, media negotiation would have stalled until all candidates were gathered.
Instead, the specification relies on Trickle ICE, which decouples candidate discovery from the base SDP negotiation. The RTCPeerConnection issues ICE candidate events incrementally as STUN and TURN checks complete. The host application must package each candidate into a discrete signaling message, transmit it across the network, and inject it on the remote peer using addIceCandidate().
Because the specification specifies no message schema for these candidates, your signaling pipeline is entirely responsible for serialization, ordering, and delivery. If your signaling server drops an ICE candidate packet, the browser runtime will not retransmit it; it assumes your application transport guarantees whatever reliability is required.
What does the Mechanics of Media and Transport Negotiation actually mean?
Once SDP payloads and ICE candidates cross your application signaling layer, the media engine transitions from application-driven state transitions to standardized IETF protocols. The transport layer relies on Interactive Connectivity Establishment (ICE), specified in RFC 8445.
Session Description Protocol Invariants
The SDP carried by your signaling protocol contains the configuration parameters required to initialize the SRTP crypto contexts and the audio pipeline. For a standard voice call, the SDP specifies payload types, sample rates, channel allocations, and feedback profiles.
A representative Opus audio line within the SDP payload demonstrates this specificity:
`text m=audio 9 UDP/TLS/RTP/SAVPF 111 a=rtpmap:111 opus/48000/2 a=fmtp:111 minptime=10;useinbandfec=1 `
Here, the signaling payload configures the RTP profile for audio with feedback (SAVPF) over DTLS. The Opus payload format, defined in RFC 7587, is pinned to dynamic payload type 111, operating at a 48,000 Hz reference clock with 2 channels. The useinbandfec=1 parameter informs the decoder that the remote encoder may include forward error correction data within the primary packet stream. The default audio packetization interval (ptime) is typically 20 ms, which produces 50 packets per second. If your signaling layer mutates or drops these parameters during transit, the receiving media engine will default to baseline configurations, possibly disabling forward error correction entirely.
Interactive Connectivity Establishment State Transitions
The browser takes the candidates ingested from your signaling layer and initiates the ICE connectivity checks. This process occurs strictly peer-to-peer (or peer-to-relay), bypassing the signaling channel completely.
`text [Signaling Plane: WebSocket/HTTP] Peer A <-------- (SDP Offers / Answers / Candidates) --------> Peer B | | | [STUN/TURN Protocol: UDP] | +------------> NAT / STUN Server <----------------------------+ | | | [Media Plane: DTLS-SRTP / RFC 8445 ICE Checks] | +============================================================> Peer B `
The browser constructs candidate pairs consisting of a local candidate and a remote candidate provided via addIceCandidate(). It then computes a 64-bit priority integer for each pair:
`text Priority = 2^32 * MIN(local_priority, remote_priority) + 2 * MAX(local_priority, remote_priority) + (local_priority > remote_priority ? 1 : 0) `
The ICE agent paces STUN Binding requests at an interval governed by the Ta timer, which defaults to 50 ms. When a STUN check receives a successful response, the pair transitions to the Succeeded state. If the agent is acting as the controlling agent, it sends an updated STUN request with the USE-CANDIDATE attribute (under standard ICE) or selects the nominated pair directly (under aggressive nomination). Only after ICE achieves a nominated, valid candidate pair does the browser initiate the DTLS handshake to derive the SRTP encryption keys. The signaling protocol plays no part in this handshake; it exists exclusively to deliver the initial fingerprint hash (via the a=fingerprint attribute) used to authenticate the DTLS certificate.
Transport Failures Under Network Degradation
When packet loss occurs on the wire, the signaling layer remains oblivious unless your application explicitly builds telemetry hooks. The media engine handles network impairment autonomously through RTP/RTCP feedback loops. When network metrics degrade—specifically when random packet loss exceeds 5% or burst loss occurs across multiple 20 ms frames—the audio pipeline reacts at the transport and codec levels.
The Opus encoder dynamically modulates its output bitrate, stepping down from a nominal voice quality of 32 kbps to lower targets, potentially hitting its 6 kbps floor if congestion worsens. Concurrently, the receiver's NetEQ jitter buffer expands. While a stable network allows the jitter buffer to hover between 20 ms and 40 ms, sudden arrival jitter forces NetEQ to increase its buffer depth to 120 ms or more to prevent frame starvation.
This introduces perceptible end-to-end latency. If packet loss exceeds the threshold where Opus In-Band Forward Error Correction can reconstruct missing audio blocks (typically above 20% loss without redundant transmission), the system relies on Packet Loss Concealment (PLC). NetEQ executes PLC by mathematically interpolating the pitch and spectral characteristics of the preceding 20 ms frame.
If three or more consecutive 20 ms packets are dropped (a 60 ms blackout), the PLC algorithm attenuates the reconstructed audio to silence to avoid generating acoustic artifacts, producing complete audio dropouts. The signaling channel, maintaining an idle TCP or WebSocket state throughout this media degradation, receives zero notification that the real-time pipeline is failing.
Edge Failure Modes and Signaling Assumptions
Because signaling is unstandardized, developers routinely make erroneous architectural assumptions about state synchronization:
- Asynchronous Glare: If both peers invoke
createOffersimultaneously, their signaling messages will cross in flight. Unlike SIP, which specifies a 491 Request Pending response with a randomized timer, WebRTC's engine simply rejectssetRemoteDescriptionwith anInvalidStateErrorif called with an offer while already inhave-local-offer. The signaling system must enforce deterministic role negotiation (such as the "Polite/Impolite" peer pattern using tie-breaker IDs). - Candidate Arrival Before Remote Description: ICE candidates often traverse signaling faster than large initial SDP blobs. If
addIceCandidate()is called beforesetRemoteDescription()has executed, the browser rejects the candidate because no media descriptions exist to bind it to. The application signaling layer must maintain an internal candidate queue and flush it only after the SDP promise chain settles. - MTU Truncation: While standard audio RTP packets are roughly 150 to 200 bytes (for 20 ms of Opus speech), the signaling payloads containing initial SDP offers often exceed 2,000 bytes due to multi-codec negotiation lists, session attributes, and candidate strings. If you attempt to send raw SDP over UDP signaling networks without application-level fragmentation, packets are silently dropped at the standard 1500-byte Ethernet MTU boundary.
The practical rule is this: Never assume the media engine knows what the signaling channel is doing, and never assume the signaling channel understands transport health. Your signaling layer must implement strict state sequencing, explicit candidate queuing, and deterministic race-condition handling, because the WebRTC specification deliberately will not do it for you.
Quick reference
A codec is an algorithm that compresses audio for transmission. A frame is the block of samples encoded at once. Lookahead is the delay a codec needs before it can begin encoding.
- Sample rate — measurements per second
- Frame size — the block encoded at once
- Lookahead — delay before encoding begins
- Bitrate — bits per second consumed
- Jitter — variation in arrival time
- Playout delay — capture to speaker
- Concealment — invention for a missing frame
- Transcoding — decode then re-encode
- Comfort noise — synthetic background in silence
- RTP — the media transport
- RTCP — the control channel
- Narrowband — roughly 300 to 3400 Hz