webrtc_media_rid (webrtc v0.1.0)
View SourceReceive side of RTP stream identifiers (RFC 8852) for webrtc_media: which simulcast layer (rid) an incoming SSRC carries.
Simulcast senders usually announce no SSRCs. A layer is recognised by the MID and RtpStreamId header extensions of its first packets, and its RTX stream by the RepairedRtpStreamId extension (RFC 8852 §3.2, RFC 9143 §9.2); RTCP SDES chunks carrying the same items teach the mapping too (RFC 8852 §4). The mapping is learned once per SSRC: later packets may omit the extensions. Only rids negotiated for the m= section are accepted (RFC 8853 §5.2).
Summary
Functions
Classify a packet of a known mid. plain: the section has no layers. {source, Rid}: a layer. {repair, Ssrc}: the RTX stream of the layer sent with Ssrc. drop: the stream cannot be attributed to a negotiated layer (yet).
Apply negotiated sections (recv_rids, recv_extensions). Learned SSRCs are kept across renegotiations.
Forget a source stream that ended.
Rid of a learned source SSRC.
Learn layers from RTCP SDES chunks with an RtpStreamId item (RFC 8852 §4). SsrcMid gives the mid of SSRCs whose chunk carries no MID item.
Source SSRC of a layer, once learned.
Types
Functions
-spec classify(binary(), #rtp{version :: 2, padding :: 0..255, marker :: boolean(), pt :: 0..127, seq :: 0..65535, ts :: 0..4294967295, ssrc :: 0..4294967295, csrcs :: [0..4294967295], ext :: undefined | {Profile :: 0..65535, Data :: binary()} | [webrtc_rtp_ext:element()], payload :: binary()}, state()) -> {plain | {source, binary()} | {repair, ssrc()} | drop, state()}.
Classify a packet of a known mid. plain: the section has no layers. {source, Rid}: a layer. {repair, Ssrc}: the RTX stream of the layer sent with Ssrc. drop: the stream cannot be attributed to a negotiated layer (yet).
Apply negotiated sections (recv_rids, recv_extensions). Learned SSRCs are kept across renegotiations.
Forget a source stream that ended.
-spec new() -> state().
Rid of a learned source SSRC.
-spec sdes([{ssrc(), [{atom() | integer() | tuple(), binary()}]}], #{ssrc() => binary()}, state()) -> state().
Learn layers from RTCP SDES chunks with an RtpStreamId item (RFC 8852 §4). SsrcMid gives the mid of SSRCs whose chunk carries no MID item.
Source SSRC of a layer, once learned.