Skip to content

WSM binary frame

WSM binary frames are used by WSMedia and BlobChannel. Media frames have a fixed 10-byte header followed by RTP/RTCP payload.

Media header

Source: Engine/Transport/WSM/WSMHeader.h

Offset Size Field Byte order Meaning
0 1 msg_type n/a 1 = media
1 1 flags n/a Reserved, currently 0
2 4 ssrc network order Media stream routing key
6 2 port network order Internal media translator port
8 2 media_type network order 1 = RTP, 2 = RTCP
10 N payload n/a RTP or RTCP packet
packet-beta
    0-7: "msg_type"
    8-15: "flags"
    16-47: "ssrc"
    48-63: "port"
    64-79: "media_type"
    80-127: "payload..."

Direction: client to server

sequenceDiagram
    participant Client
    participant WSM as WSMServer
    participant UDP as UDP socket
    participant Translator

    Client->>WSM: WSM media frame(ssrc, port, RTP/RTCP)
    WSM->>WSM: find/create UDP socket by ssrc
    WSM->>UDP: send payload to 127.0.0.1:port
    UDP->>Translator: RTP/RTCP

Direction: server to client

sequenceDiagram
    participant Translator
    participant UDP as UDP socket
    participant WSM as WSMServer
    participant Client

    Translator->>UDP: RTP/RTCP
    UDP->>WSM: callback(local UDP port)
    WSM->>WSM: local UDP port -> ssrc
    WSM->>Client: WSM media frame(ssrc, src port, RTP/RTCP)
    Client->>Client: demux by ssrc

Media types

Value Name Use
1 RTP Audio/video payload packets.
2 RTCP Control packets, including keyframe requests.

Blob header

Blob frames use a separate 20-byte header and must not be sent through WSMedia.

Offset Size Field Meaning
0 1 msg_type 2 = blob
1 1 reserved Reserved
2 2 blob_type SpeedTest, File, Voice, Image
4 16 guid Raw GUID/UUID

Compatibility

Because the routing key is ssrc, the same WSMedia session can carry any number of media streams. This is the protocol-level basis for browser mux and native WSS fallback mux.