webrtc_rtx (webrtc v0.1.0)
View SourceRTP retransmission payload format (RFC 4588 §4).
A retransmission packet carries the original sequence number (OSN) in the first two payload octets, followed by the original payload. WebRTC uses SSRC multiplexing (RFC 8834 §6.1): the retransmission stream has its own SSRC in the same RTP session, the RTX payload type negotiated through a=fmtp:<rtx> apt=<pt> and its own sequence numbers, which the caller supplies. The timestamp (RFC 4588 §4 MUST), marker bit, CSRC list and header extensions are those of the original packet. Padding of the original packet is not copied.
Summary
Functions
Recover the original packet from a retransmission packet, given the SSRC and payload type of the original stream. RTX packets without an OSN (padding-only packets, used for bandwidth probing) return {error, no_osn}.
Wrap an original packet into a retransmission packet.
Original sequence number of a retransmission packet.
Types
Functions
-spec decapsulate(#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()}, orig_params()) -> {ok, #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()}} | {error, no_osn}.
Recover the original packet from a retransmission packet, given the SSRC and payload type of the original stream. RTX packets without an OSN (padding-only packets, used for bandwidth probing) return {error, no_osn}.
-spec encapsulate(#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()}, rtx_params()) -> #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()}.
Wrap an original packet into a retransmission packet.
-spec osn(#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()}) -> {ok, 0..65535} | {error, no_osn}.
Original sequence number of a retransmission packet.