rtciv0.5.0

rtci-rtp

RTP packets, header extensions (RFC 3550, RFC 8285) and codec payload formats for WebRTC. 36 public modules, 363 items at 0.5.0.

README

RTP packets and headers, one-byte and two-byte header extensions with typed codecs for the extensions WebRTC uses, and per-codec packetizers and depacketizers, including the SVC layer structures and the SFrame payload format.

Specifications

  • RFC 3550, RTP; RFC 3551, the audio/video profile; RFC 8285, header extensions
  • Payload formats: RFC 6184 (H.264), RFC 7798 (H.265), RFC 7741 (VP8), RFC 9628 (VP9), the AV1 RTP specification, RFC 7587 (Opus), RFC 4733 (DTMF), RFC 2198 (RED), RFC 3389 (comfort noise)
  • Header extensions: RFC 6464 and RFC 6465 (audio levels), RFC 7941 (SDES items), abs-send-time, abs-capture-time, transport-wide sequence numbers, the AV1 dependency descriptor
  • draft-ietf-avtcore-rtp-sframe, the SFrame payload format; W3C WebRTC SVC scalability modes

Clause-by-clause status, with the test that proves each clause: rfc3550, rfc8285, rfc6184, rfc7798, rfc7741, rfc9628, av1-rtp, rfc7587, rfc4733.

Use

packet::Packet and header::Header marshal and unmarshal through rtci-shared's traits and get or set extensions by id; packetizer::Packetizer with a codec payloader turns an encoded frame into payloads, and the depacketizers reverse it. The root crate (rtci) uses it for every media stream.

Sans-I/O

Codecs and packetizers only: no socket, no clock (timestamps come from the caller), no encryption (that is rtci-srtp).

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_rtp

RTP packets, header extensions and packetization.

  • modclock_rateSeveral clock rates in one RTP session ([RFC 7160]): the SSRC, timestamp and jitter rules.
  • modcodecPer-codec payloaders and depacketizers (VP8, VP9, AV1, H.264, H.265, Opus, G.711), and telephone-event, comfort noise and RED.
  • modextensionThe typed RTP header extensions ([RFC 8285]).
  • modheaderThe RTP header and its extensions.
  • modpacketA whole RTP packet: header plus payload.
  • modpacketizerTurning encoded frames into RTP packets, and back again.
  • modsequenceSequence-number generation, starting from a random offset as the RFC requires.
  • useHeaderfrom header::HeaderHeader represents an RTP packet header NOTE: PayloadOffset is populated by Marshal/Unmarshal and should not be modified
  • usePacketfrom packet::PacketPacket represents an RTP Packet NOTE: Raw is populated by Marshal/Unmarshal and should not be modified

rtci_rtp::clock_rate

Several clock rates in one RTP session ([RFC 7160]): the SSRC, timestamp and jitter rules.

  • structArrivalOne received packet, as the jitter calculation needs it.
  • structClockRateHistoryThe clock rates one RTP stream has used, for the SSRC rule of RFC 7160 section 4.1: a different SSRC for each clock rate, and a BYE and a new SSRC when the stream switches back to a rate it already used.
  • structJitterEstimatorThe interarrival jitter estimator of RFC 3550 section 6.4.1 and Appendix A.8, fed with the difference of RFC 7160 section 4.3 so that a stream may change clock rate.
  • structMultiRateTimestampThe RTP timestamp of a sender that keeps one SSRC across clock rate changes, which RFC 7160 section 4.2 allows only with RTCP turned off:
  • enumSsrcForClockRateWhat a sender that sends RTCP does with its SSRC when the clock rate of its stream changes (RFC 7160 section 4.1).
  • fninterarrival_differenceD(i,j) of RFC 7160 section 4.3, in units of packet i's clock:

rtci_rtp::codec

Per-codec payloaders and depacketizers (VP8, VP9, AV1, H.264, H.265, Opus, G.711), and telephone-event, comfort noise and RED.

  • modav1AV1 payload format ([RFC 9628]).
  • modcomfort_noiseComfort noise payload format ([RFC 3389]).
  • moddependency_descriptorThe Dependency Descriptor RTP header extension (AV1 RTP specification, appendix A).
  • modg7xxG.711 and G.722 payload formats, which need no fragmentation.
  • modh264H.264 payload format ([RFC 6184]): STAP-A aggregation and FU-A fragmentation.
  • modh265H.265/HEVC payload format ([RFC 7798]).
  • modopaqueA format-agnostic payload (bytes the RTP layer does not parse, such as SFrame).
  • modopusOpus payload format ([RFC 7587]), one packet per frame.
  • modredRedundant audio data, RED ([RFC 2198]).
  • modsframeThe RTP payload format of SFrame, draft-ietf-avtcore-rtp-sframe-03 (pinned to that revision, 21 October 2026).
  • modsmpte336mSMPTE ST 336 (KLV) payload ([RFC 6597]).
  • modsvcScalable video coding: the scalability modes of the W3C "Scalable Video Coding (SVC) Extension for WebRTC" and the layer structure of each.
  • modtelephone_eventNamed telephone events and DTMF ([RFC 4733]).
  • modtoneThe audio/tone payload format: telephony tones described by their frequencies (RFC 4733 section 4).
  • modvp8VP8 payload format ([RFC 7741]).
  • modvp9VP9 payload format (draft-ietf-payload-vp9).

rtci_rtp::codec::av1

AV1 payload format ([RFC 9628]).

  • structAv1Depacketizerfrom depacketizer::Av1DepacketizerAV1 RTP Depacketizer
  • structAv1FramePayloadsThe packets of one frame of a temporal unit, from Av1Payloader::payload_frames.
  • structAv1LayerDatafrom temporal_unit::Av1LayerDataThe OBUs of one spatial layer of a temporal unit, as they were in the unit.
  • structAv1PayloaderPacketizes AV1 temporal units into RTP payloads.
  • fnrepeat_sequence_header_per_layerfrom temporal_unit::repeat_sequence_header_per_layerFor an "S" mode (spatial layers that do not predict from each other: simulcast in one RTP stream), puts a copy of the unit's sequence header in front of every layer after the first that has none, so that a forwarder can keep any one layer and leave it decodable (AV1 RTP section 6.1: "a sequence header OBU SHOULD be aggregated with each spatial layer"). A unit without a sequence header (not a …
  • fnsplit_temporal_unitfrom temporal_unit::split_temporal_unitThe spatial layers of temporal_unit (low overhead bitstream format, AV1 specification 5.2), lowest first, each with its OBUs unchanged. OBUs without an extension header (the temporal delimiter, a sequence header, metadata) go with the layer whose OBUs follow them, those at the end with the last layer. A unit without extension headers is one layer.

rtci_rtp::codec::comfort_noise

Comfort noise payload format ([RFC 3389]).

  • structComfortNoiseOne comfort-noise payload (sections 3.1 to 3.3).
  • structComfortNoisePacketDepacketizes CN: the payload is one CN payload (or one per channel), returned as is.
  • structComfortNoisePayloaderPayloads CN: one CN payload per RTP packet, never fragmented.
  • fnmarshal_channelsConcatenates one CN payload per channel, channel order as given (section 4).
  • fnquantize_reflection_coefficientThe quantised index of a reflection coefficient, the inverse of reflection_coefficient: N_i = round(k_i * 32768 / 258) + 127, clamped to 0..=254. A NaN maps to the zero coefficient.
  • fnreflection_coefficientThe reflection coefficient of a quantised index (section 3.2): k_i = 258 * (N_i - 127) / 32768. None for the reserved index 255.
  • fnunmarshal_channelsSplits a packet's payload into one CN payload per channel (section 4).
  • constCN_MAX_COEFFICIENT_INDEXThe largest valid quantised reflection coefficient index; 255 is reserved (section 3.2).
  • constCN_MAX_LEVELThe largest noise level, in -dBov (section 3.1).
  • constCN_STATIC_CLOCK_RATEClock rate of CN_STATIC_PAYLOAD_TYPE. Other rates use dynamic payload types.
  • constCN_STATIC_PAYLOAD_TYPEThe static RTP payload type of CN at 8000 Hz (RFC 3389 section 4, RFC 3551).
  • constCN_ZERO_COEFFICIENT_INDEXThe quantised index of a zero reflection coefficient: k(127) = 0.

rtci_rtp::codec::dependency_descriptor

The Dependency Descriptor RTP header extension (AV1 RTP specification, appendix A).

  • structDecodeTargetSelectorfrom selector::DecodeTargetSelectorDecides, in a forwarder, which frames of a stream to forward to one receiver, from the Dependency Descriptor alone (AV1 RTP specification A.1, A.5 to A.7).
  • structDependencyDescriptorOne Dependency Descriptor: what one RTP packet says about its frame (AV1 RTP specification A.8).
  • structDependencyDescriptorReaderThe receive side of the Dependency Descriptor: reads the descriptors of one RTP stream, keeping the structure and the active decode targets from packet to packet (AV1 RTP specification A.4, A.8).
  • structDependencyDescriptorWriterfrom writer::DependencyDescriptorWriterThe send side of the Dependency Descriptor for one RTP stream (AV1 RTP specification A.4, A.8.3).
  • structFrameDependencyStructureThe frame dependency structure of a coded video sequence (template_dependency_structure, AV1 RTP specification A.8.2): the decode targets, the templates and the chains.
  • structFrameDependencyTemplateA frame dependency template: what many frames of a stream have in common (AV1 RTP specification A.8.1).
  • structFrameDescriptorfrom writer::FrameDescriptorThe Dependency Descriptor of one frame, ready to be written on each of its packets.
  • structRenderResolutionThe largest size the frames of a spatial layer are rendered at (render_resolutions).
  • enumDecodeTargetIndicationHow a frame relates to a decode target (AV1 RTP specification, table A.1).
  • constDEPENDENCY_DESCRIPTOR_URIThe a=extmap URI of the Dependency Descriptor (AV1 RTP specification A.9).
  • constMAX_DECODE_TARGETSThe most decode targets a structure can have (dt_cnt_minus_one is five bits).
  • constMAX_FRAME_DIFFThe largest frame difference a descriptor can carry (fdiff_minus_one is at most twelve bits).
  • constMAX_TEMPLATE_CHAIN_DIFFThe largest chain difference a template can carry (four bits).
  • constMAX_TEMPLATE_FRAME_DIFFThe largest frame difference a template can carry (fdiff_minus_one is four bits there).
  • constMAX_TEMPLATESThe most templates a structure can have (frame_dependency_template_id is six bits).

rtci_rtp::codec::g7xx

G.711 and G.722 payload formats, which need no fragmentation.

  • structG7xxPayloaderPacketizes G.711/G.722 audio (RFC 3551 sections 4.5.2 and 4.5.14).
  • typeG711PayloaderG711Payloader payloads G711 packets
  • typeG722PayloaderG722Payloader payloads G722 packets
  • constG722_PAYLOAD_TYPEThe static payload type of G722 (RFC 3551 section 6, Table 4).
  • constG7XX_CLOCK_RATEThe RTP clock rate of PCMU, PCMA and G722. G.722 samples at 16000 Hz, and its RTP clock is 8000 Hz all the same (RFC 3551 section 4.5.2).
  • constPCMA_PAYLOAD_TYPEThe static payload type of PCMA, G.711 A-law at 8000 Hz (RFC 3551 section 6, Table 4).
  • constPCMU_PAYLOAD_TYPEThe static payload type of PCMU, G.711 mu-law at 8000 Hz (RFC 3551 section 6, Table 4).

rtci_rtp::codec::h264

H.264 payload format ([RFC 6184]): STAP-A aggregation and FU-A fragmentation.

  • structH264DeinterleavingBufferThe de-interleaving buffer of interleaved mode (RFC 6184 section 7.2.2): NAL units go in in reception order with their DON and come out in decoding order.
  • structH264NalUnitOne NAL unit taken out of an RTP payload.
  • structH264PacketH264Packet represents the H264 header that is stored in the payload of an RTP Packet
  • structH264PayloaderH264Payloader payloads H264 packets
  • structMtapUnitOne NAL unit to place in a multi-time aggregation packet.
  • enumMtapKindThe width of the timestamp offset in a multi-time aggregation packet.
  • fndon_diffdon_diff(m, n) of RFC 6184 section 5.5: positive when the NAL unit with DON n follows the one with DON m in decoding order, negative when it precedes it, zero when they share a DON.
  • fnmtapBuilds an MTAP16 or MTAP24 payload (RFC 6184 section 5.7.2) and the RTP timestamp its packet carries.
  • fnstap_aBuilds a STAP-A payload (RFC 6184 section 5.7.1): the NAL units of one access unit, in decoding order.
  • fnstap_bBuilds a STAP-B payload (RFC 6184 section 5.7.1): a STAP-A whose first NAL unit has the decoding order number don, each following one the number after it (modulo 65536).
  • constAUD_NALU_TYPENAL type 9: access unit delimiter.
  • constFILLER_NALU_TYPENAL type 12: filler data, which is dropped rather than sent.
  • constFU_END_BITMASKFU header end bit: this fragment completes a NAL unit.
  • constFU_START_BITMASKFU header start bit: this fragment begins a NAL unit.
  • constFUA_HEADER_SIZEBytes of FU-A header prefixed to each fragment.
  • constFUA_NALU_TYPENAL type 28: FU-A, which fragments one NAL unit across several payloads.
  • constFUB_HEADER_SIZEBytes of FU-B header prefixed to a first fragment: FU indicator, FU header and DON.
  • constFUB_NALU_TYPENAL type 29: FU-B, the first fragment of a NAL unit in interleaved mode: an FU-A with a decoding order number.
  • constIDR_NALU_TYPENAL type 5: a coded slice of an IDR picture.
  • constMAX_DEINTERLEAVING_BYTESNor more bytes than this.
  • constMAX_DEINTERLEAVING_NAL_UNITSThe de-interleaving buffer never holds more NAL units than this, whatever sprop-interleaving-depth asks for: past it the NAL unit that is next in decoding order is passed on.
  • constMAX_FUA_NALU_SIZELargest NAL unit reassembled from FU-A fragments. Far above any real slice (a 4K intra frame is a few hundred KiB); a reassembly that would grow past it is dropped.
  • constMTAP_HEADER_SIZEBytes of MTAP header prefixed to an aggregate: the type octet and the DON base.
  • constMTAP16_NALU_TYPENAL type 26: MTAP16, an aggregate of NAL units of several access units, with 16-bit timestamp offsets (interleaved mode).
  • constMTAP24_NALU_TYPENAL type 27: MTAP24, MTAP16 with 24-bit timestamp offsets.
  • constNALU_FORBIDDEN_BITMASKMask selecting forbidden_zero_bit from a NAL header byte.
  • constNALU_REF_IDC_BITMASKMask selecting nal_ref_idc from a NAL header byte.
  • constNALU_TYPE_BITMASKMask selecting the NAL type from a NAL header byte.
  • constOUTPUT_STAP_AHEADERThe STAP-A header byte for aggregated NAL units whose nal_ref_idc is 3 (parameter sets as encoders write them). The payloader computes the header from the units it aggregates (RFC 6184 section 5.7: F is the OR of their F bits, NRI the maximum of their NRIs); this constant is that value for the common case.
  • constPPS_NALU_TYPENAL type 8: picture parameter set.
  • constSEI_NALU_TYPENAL type 6: supplemental enhancement information.
  • constSPS_NALU_TYPENAL type 7: sequence parameter set.
  • constSTAPA_HEADER_SIZEBytes of STAP-A header prefixed to an aggregate.
  • constSTAPA_NALU_LENGTH_SIZEBytes of length prefix before each NAL unit inside a STAP-A.
  • constSTAPA_NALU_TYPENAL type 24: STAP-A, which aggregates several small NAL units into one payload.
  • constSTAPB_HEADER_SIZEBytes of STAP-B header prefixed to an aggregate: the type octet and the DON.
  • constSTAPB_NALU_TYPENAL type 25: STAP-B, a STAP-A with a decoding order number (interleaved mode).
  • staticANNEXB_NALUSTART_CODEThe Annex B start code (00 00 00 01) that delimits NAL units in a byte stream.

rtci_rtp::codec::h265

H.265/HEVC payload format ([RFC 7798]).

  • structH265AggregationPacketH265AggregationPacket represents an Aggregation packet. 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PayloadHdr (Type=48) | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | …
  • structH265AggregationUnitH265AggregationUnit represent the an Aggregation Unit in an AP, which is not the first one.
  • structH265AggregationUnitFirstAggregation Packets implementation
  • structH265DepacketizationBufferThe de-packetization buffer of RFC 7798 section 6, for a stream whose sprop-max-don-diff is greater than 0: NAL units go in in reception order and come out in decoding order, by AbsDon (section 4.6).
  • structH265FragmentationUnitHeaderFragmentation Unit implementation
  • structH265FragmentationUnitPacketH265FragmentationUnitPacket represents a single Fragmentation Unit packet.
  • structH265MultiStreamDepacketizerThe receiver of an HEVC bitstream carried in several RTP streams: MRST (several streams on one transport) and MRMT (several streams on several transports), RFC 7798 section 4.3: "Receivers MUST support all of SRST, MRST, and MRMT". It holds the RTP streams of one bitstream, in dependency order, and passes their NAL units on in decoding order as RFC 7798 section 6 describes:
  • structH265NALUHeaderH265NALUHeader is a H265 NAL Unit Header
  • structH265NalUnitOne NAL unit taken out of an RTP payload.
  • structH265PACIPacketPACI implementation
  • structH265PacketPacket implementation
  • structH265SingleNALUnitPacketSingle NAL Unit Packet implementation
  • structH265TSCITemporal Scalability Control Information
  • structHevcPayloaderPacketizes H.265/HEVC NAL units into RTP payloads, fragmenting when needed.
  • enumH265PayloadH265 Payload Enum
  • enumUnitTypeThe H.265 NAL unit types this payloader distinguishes.
  • constH265FRAGMENTATION_UNIT_HEADER_SIZEBytes of FU header following the payload header in a fragmentation unit.
  • constMAX_DEPACKETIZATION_BYTESNor more bytes than this.
  • constMAX_DEPACKETIZATION_NAL_UNITSThe de-packetization buffer never holds more NAL units than this, whatever sprop-depack-buf-nalus and sprop-max-don-diff ask for.
  • constMAX_H265_FU_NALU_SIZELargest NAL unit reassembled from fragmentation units. Far above any real slice; a reassembly that would grow past it is dropped.
  • constNAL_HEADER_SIZEBytes in an H.265 NAL header — two, unlike H.264's one.
  • constRTP_OUTBOUND_MTUThe payload MTU this payloader targets, chosen to survive typical paths without IP fragmentation.
  • staticAGGR_PAYLOAD_HDRPayload header for an aggregation packet.
  • staticANNEXB_3_NALUSTART_CODEThe three-byte Annex B start code (00 00 01).
  • staticFRAG_PAYLOAD_HDRPayload header for a fragmentation unit.
  • staticFU_HDR_B_EFU header for the last fragment of a B frame.
  • staticFU_HDR_B_MFU header for a middle fragment of a B frame.
  • staticFU_HDR_B_SFU header for the first fragment of a B frame.
  • staticFU_HDR_IDR_EFU header for the last fragment of an IDR frame.
  • staticFU_HDR_IDR_MFU header for a middle fragment of an IDR frame.
  • staticFU_HDR_IDR_SFU header for the first fragment of an IDR frame.
  • staticFU_HDR_P_EFU header for the last fragment of a P frame.
  • staticFU_HDR_P_MFU header for a middle fragment of a P frame.
  • staticFU_HDR_P_SFU header for the first fragment of a P frame.
  • staticSING_PAYLOAD_HDRPayload header for a single NAL unit packet.

rtci_rtp::codec::opaque

A format-agnostic payload (bytes the RTP layer does not parse, such as SFrame).

  • structOpaqueDepacketizerReassembles the units OpaquePayloader split. A unit is returned when its E payload arrives; a payload that continues a unit whose start was not seen (a lost packet) drops the unit whole: the bytes of a ciphertext are useless without all of them.
  • structOpaquePayloaderSplits a unit of arbitrary bytes into payloads of at most mtu, each behind the flags byte. An empty unit is one payload with both flags.
  • constOPAQUE_ENDThe end-of-unit flag.
  • constOPAQUE_HEADER_SIZESize of the payload header.
  • constOPAQUE_STARTThe start-of-unit flag.

rtci_rtp::codec::opus

Opus payload format ([RFC 7587]), one packet per frame.

  • structOpusPacketOpusPacket represents the Opus header that is stored in the payload of an RTP Packet
  • structOpusPayloaderPacketizes Opus audio: one RTP payload per Opus packet, never fragmented and never aggregated, whatever the MTU (RFC 7587 section 4.2).
  • fnopus_packet_samplesThe duration of an Opus packet in samples at 48 kHz, which is its length in RTP timestamp units (RFC 7587 section 4.1), read from the TOC byte and the frame count (RFC 6716 section 3.1 and 3.2).
  • constOPUS_CLOCK_RATEThe RTP clock rate of Opus, whatever the audio bandwidth coded (RFC 7587 section 4.1).
  • constOPUS_DTX_TIMESTAMP_STEPWhat DTX timestamp gaps are multiples of, in samples at 48 kHz: 2.5 ms, the shortest Opus frame (RFC 7587 section 3.1.3).
  • constOPUS_MAX_PACKET_SAMPLESThe longest Opus packet, in samples at 48 kHz: 120 ms (RFC 6716 section 3.2.5).

rtci_rtp::codec::red

Redundant audio data, RED ([RFC 2198]).

  • structRecoveredBlockA payload a RedDecoder delivers.
  • structRecoveredMediaA block RedDecoder::decode_rtp delivers, with what of the RED packet's header applies to it (RFC 2198 section 4).
  • structRedBlockOne block of a RED payload.
  • structRedDecoderUnpacks RED packets and recovers lost primaries from later packets' redundant blocks (RFC 2198 section 3), without delivering anything twice.
  • structRedDepacketizerReturns a RED payload's primary data, for audio streams whose RED payload type is depacketized like a codec. Redundant blocks are dropped; use RedDecoder to recover from them.
  • structRedEncoderBuilds RED payloads whose redundancy is copies of the previous primaries (RFC 2198 section 3), the way Chrome sends Opus RED.
  • structRedPacketOne RED payload: redundant blocks in header order, then the primary.
  • fnformat_red_fmtpFormats a RED fmtp list: payload types joined by /.
  • fnparse_red_fmtpParses the RED fmtp list, a=fmtp:<pt> 111/111 (section 5): the payload types of the primary and then the redundant encodings, slash-separated.
  • constRED_DEFAULT_DUPLICATE_WINDOWThe default number of recent deliveries a RedDecoder remembers.
  • constRED_MAX_BLOCK_LENGTHThe largest redundant block length (10 bits).
  • constRED_MAX_BLOCKSThe most blocks (redundant ones plus the primary) a RedPacket may have. RFC 2198 sets no limit; one or two levels of redundancy are usual, and 32 bounds the parser's work.
  • constRED_MAX_DUPLICATE_WINDOWThe largest duplicate window a RedDecoder accepts.
  • constRED_MAX_PAYLOAD_TYPEThe largest RTP payload type (7 bits).
  • constRED_MAX_TIMESTAMP_OFFSETThe largest timestamp offset (14 bits).
  • constRED_PRIMARY_HEADER_SIZESize of the primary block header.
  • constRED_REDUNDANT_HEADER_SIZESize of a redundant block header.

rtci_rtp::codec::sframe

The RTP payload format of SFrame, draft-ietf-avtcore-rtp-sframe-03 (pinned to that revision, 21 October 2026).

  • structSFrameDepacketizerThe Depacketizer form of section 5.2 for packets in order (behind a jitter buffer): the fragments from S to E are concatenated without their descriptors; a frame whose fragments disagree on T is discarded (step 6). origin is the payload origin of the last frame it returned.
  • structSFramePayloaderSection 5.1: fragments an SFrame ciphertext into RTP payloads no larger than the MTU, each behind its descriptor. The RTP layer sets the marker bit on the last packet of the frame (step 8: the marker is E when the frame's marker is set).
  • structSFrameReassemblerSection 5.2 over packets that may arrive in any order: each packet is added to the set of received packets; the smallest run of consecutive sequence numbers from an S packet to an E packet is taken out and, unless its fragments disagree on T or on the payload type (steps 6, 7: the frame is discarded), returned as an SFrameRtpFrame. Section 9.7: at most max_buffered packets are held, the …
  • structSFrameRtpFrameAn SFrame frame that section 5.2 reassembled: the SFrame ciphertext (the payload, step 9) and its SFrame RTP metadata (step 10), for the application to decrypt (step 11) and then hand to the receiving pipeline (raw) or to the payload type's depacketizer (packetized).
  • enumSFramePayloadOriginThe SFrame RTP metadata's payload origin (section 5.1): what the SFrame frame protects.
  • constDEFAULT_MAX_BUFFERED_PACKETSThe default bound on the packets SFrameReassembler holds (section 9.7).
  • constSFRAME_DESCRIPTOR_SIZEThe size of the SFrame payload descriptor.
  • constSFRAME_ENDThe E bit: the last fragment of an SFrame frame.
  • constSFRAME_PACKETIZEDThe T bit: the frame protects packetized media (1) or a raw frame (0).
  • constSFRAME_STARTThe S bit: the first fragment of an SFrame frame.

rtci_rtp::codec::smpte336m

SMPTE ST 336 (KLV) payload ([RFC 6597]).

rtci_rtp::codec::svc

Scalable video coding: the scalability modes of the W3C "Scalable Video Coding (SVC) Extension for WebRTC" and the layer structure of each.

  • structLayerFrameOne frame of a picture of a ScalabilityPattern: one spatial layer's frame, with what it depends on and how it relates to each decode target.
  • structScalabilityPatternThe dependency structure of a ScalabilityMode, as a generator of pictures.
  • enumInterLayerPredictionHow the spatial layers of a mode depend on each other (the "Inter-layer dependency" column of the specification's table, and its _KEY suffix).
  • enumResolutionRatioThe ratio between the resolutions of two neighbouring spatial layers.

rtci_rtp::codec::telephone_event

Named telephone events and DTMF ([RFC 4733]).

  • structEventPacketOne packet the TelephoneEventSender wants sent: the RTP header fields it decides plus the payload. The caller fills in the sequence number (the audio stream's next one), SSRC and the telephone-event payload type.
  • structEventSetA set of event codes, as the events fmtp parameter lists them (section 2.4).
  • structPackedEventPacketA packet carrying several events (RFC 4733 section 2.5.1.5), as packed_telephone_event_packets makes it.
  • structTelephoneEventOne named-event report (section 2.3).
  • structTelephoneEventReceiverThe receiving procedures of RFC 4733 section 2.5.2, sans-I/O: feed it every telephone-event packet's timestamp, marker and payload, get back started / updated / ended reports.
  • structTelephoneEventSenderThe sending procedures of RFC 4733 section 2.5.1 for one event at a time, sans-I/O.
  • enumTelephoneEventReportWhat a TelephoneEventReceiver learned from a packet.
  • fndtmf_char_from_eventThe DTMF character of an event code 0 to 15 (A-D upper case); None for any other code.
  • fndtmf_event_from_charThe event code of a DTMF character (0-9, *, #, A-D, case-insensitive), section 3.2.
  • fnmarshal_telephone_eventsMarshals one or more reports into one payload, in order (section 2.5.1.5).
  • fnpacked_telephone_event_packetsEvents that follow one another without overlap and without a pause, (event, volume, duration) each, the first beginning at rtp_timestamp, packed into one packet (RFC 4733 section 2.5.1.5): "the RTP timestamp MUST identify the beginning of the first event", "the M bit MUST be set if the packet records the beginning of at least one event" (each event here begins in it), and each event's E …
  • fnparse_telephone_eventsParses a telephone-event payload holding one or more reports (section 2.5.1.5).
  • fntelephone_event_packetsEvery packet for one event of total_duration units starting at rtp_timestamp, with an update every interval units: updates at interval, 2 * interval, ... below the total, then the final report three times. This is what an RTCDTMFSender-like caller sends for one tone (interval is typically 50 ms worth of units, section 2.5.1.2).
  • constDTMF_0DTMF digit 0 (section 3.2).
  • constDTMF_1DTMF digit 1.
  • constDTMF_2DTMF digit 2.
  • constDTMF_3DTMF digit 3.
  • constDTMF_4DTMF digit 4.
  • constDTMF_5DTMF digit 5.
  • constDTMF_6DTMF digit 6.
  • constDTMF_7DTMF digit 7.
  • constDTMF_8DTMF digit 8.
  • constDTMF_9DTMF digit 9.
  • constDTMF_ADTMF A.
  • constDTMF_BDTMF B.
  • constDTMF_CDTMF C.
  • constDTMF_DDTMF D.
  • constDTMF_POUNDDTMF #.
  • constDTMF_STARDTMF *.
  • constTELEPHONE_EVENT_END_REPEATSHow many times the final report of an event is sent (section 2.5.1.4).
  • constTELEPHONE_EVENT_MAX_SEGMENT_DURATIONThe largest duration one report (one segment) can carry (section 2.5.1.3).
  • constTELEPHONE_EVENT_MAX_VOLUMEThe largest volume value: the field is 6 bits, 0 to -63 dBm0 (section 2.3.4).
  • constTELEPHONE_EVENT_SIZESize of one event report on the wire.

rtci_rtp::codec::tone

The audio/tone payload format: telephony tones described by their frequencies (RFC 4733 section 4).

  • structRedundantToneSenderThe sending procedures of RFC 4733 section 4.4, sans-I/O: tones cut into packets as ToneSender does, at the interval a ToneIntervalControl keeps (section 4.4.3), each payload an RFC 2198 RED payload whose primary is the new tone report and whose redundant blocks are the reports sent before it (section 4.4.1: "for increased reliability, the sender SHOULD combine new and old tone reports in …
  • structToneOne tone report (RFC 4733 section 4.3.3, Figure 2).
  • structToneIntervalControlThe packetization interval of initial and interim tone reports under congestion (RFC 4733 section 4.4.3): "If the sender determines that packets are being lost due to congestion (e.g., through RTCP receiver reports), it SHOULD increase the packetization interval for initial and interim tone reports ... Both the maximum packetization interval and maximum increase in packetization interval at …
  • structTonePacketOne packet of a tone: its RTP timestamp, marker bit and payload.
  • structToneSenderCuts a tone into packets, without redundancy (RFC 4733 section 4.4.1): "The RTP timestamp MUST be updated for each packet generated ... the RTP timestamp in each subsequent packet MUST equal the sum of the timestamp and the duration in the preceding packet"; the first packet has the marker set and the rest not (section 4.3.2). RedundantToneSender adds the RFC 2198 combination the same …
  • constTONE_DEFAULT_CLOCK_RATEThe default clock rate of audio/tone (RFC 4733 section 4.3.4).
  • constTONE_DEFAULT_MAX_PAYLOAD_SIZEThe default largest RED payload of a RedundantToneSender, in octets.
  • constTONE_DEFAULT_REDUNDANCYThe default redundancy of a RedundantToneSender: each packet carries the tone report of the packet before (RFC 4733 section 4.4.1: "combine new and old tone reports").
  • constTONE_HIGH_LOSS_FRACTIONAt or above this RTCP fraction lost (out of 256; 26 is 10.2 %), a receiver report means congestion and ToneIntervalControl lengthens the interval. The loss-based controller's "more than 10 %" (draft-ietf-rmcat-gcc-02 section 6).
  • constTONE_LOW_LOSS_FRACTIONAt or below this RTCP fraction lost (out of 256; 5 is 1.95 %), a receiver report means no congestion and ToneIntervalControl shortens the interval again. The loss-based controller's "less than 2 %" (draft-ietf-rmcat-gcc-02 section 6).

rtci_rtp::codec::vp8

VP8 payload format ([RFC 7741]).

  • structVp8FrameInfoWhat the encoder knows about one VP8 frame and the payload descriptor carries (RFC 7741 section 4.2). The default describes a frame of a stream without temporal layers.
  • structVp8PacketVp8Packet represents the VP8 header that is stored in the payload of an RTP Packet
  • structVp8PayloaderVp8Payloader payloads VP8 packets
  • structVp8TemporalLayerThe temporal layer of one VP8 frame, as the encoder reports it (RFC 7741 section 4.2).
  • structVp8TemporalLayerFilterDecides which packets of a VP8 stream with temporal layers to forward for a target frame rate (RFC 7741 sections 4.2 and 8: discarding by TID).
  • constVP8_HEADER_SIZEBytes of mandatory VP8 payload descriptor prefixed to each payload.
  • constVP8_MAX_KEY_IDXThe highest KEYIDX the five-bit field carries (RFC 7741 section 4.2).
  • constVP8_MAX_TEMPORAL_IDThe highest temporal layer id the two-bit TID field carries (RFC 7741 section 4.2).

rtci_rtp::codec::vp9

VP9 payload format (draft-ietf-payload-vp9).

  • structVp9ForwardWhat a Vp9LayerFilter decided for one packet.
  • structVp9FrameInfoWhat the encoder knows about one VP9 frame (one spatial layer of a picture) and the payload descriptor carries (RFC 9628 section 4.2).
  • structVp9LayerFilterDecides which packets of a layered VP9 stream to forward for a target spatial and temporal layer, from the payload descriptor alone (RFC 9628 sections 4.2 and 9).
  • structVp9PacketVp9Packet represents the VP9 header that is stored in the payload of an RTP Packet
  • structVp9PayloaderVp9Payloader payloads VP9 packets.
  • structVp9PictureGroupEntryOne picture of a VP9 picture group (RFC 9628 section 4.2.1): its temporal layer, whether it is a switching up point, and the pictures it predicts from.
  • structVp9ScalabilityStructureThe VP9 scalability structure (SS, RFC 9628 section 4.2.1): the number of spatial layers, their resolutions, and for a fixed prediction pattern the picture group (PG).
  • fnjoin_superframefrom superframe::join_superframeframes as one chunk: a single frame as it is, two to eight frames followed by a superframe index (with the smallest size field that holds the largest frame). A single frame whose last byte looks like a superframe marker gets an index of its own, so that it is not taken for a superframe.
  • fnsplit_superframefrom superframe::split_superframeThe frames of chunk: those its superframe index lists, in order, or the chunk itself when it has no index (Annex B.3: the index is recognised by its marker byte at the end, repeated at the start of the index). An empty chunk has no frame.
  • typeInitialPictureIDFnInitialPictureIDFn is a function that returns random initial picture ID.
  • constVP9_MAX_P_DIFFThe largest reference index (P_DIFF) the seven-bit field carries.
  • constVP9_MAX_SPATIAL_IDThe highest spatial layer id the three-bit SID field carries (RFC 9628 section 4.2).
  • constVP9_MAX_SUPERFRAME_FRAMESfrom superframe::VP9_MAX_SUPERFRAME_FRAMESThe most frames a superframe index describes (frames_in_superframe_minus_1 is 3 bits).
  • constVP9_MAX_TEMPORAL_IDThe highest temporal layer id the three-bit TID field carries (RFC 9628 section 4.2).

rtci_rtp::extension

The typed RTP header extensions ([RFC 8285]).

rtci_rtp::extension::abs_capture_time_extension

Absolute capture time: when a frame was captured, on the capturer's NTP clock.

rtci_rtp::extension::abs_send_time_extension

Absolute send time, for one-way-delay based bandwidth estimation.

rtci_rtp::extension::audio_level_extension

Per-packet audio loudness and voice activity ([RFC 6464]).

  • structAudioLevelExtensionAudioLevelExtension is a extension payload format described in <https://tools.ietf.org/html/rfc6464>
  • fnparse_vad_attributeReads the vad extension attribute of an a=extmap line for this extension (RFC 6464 section 4): vad=on or vad=off, and vad=on when there is none. The answer says whether the V bit is in use.
  • constAUDIO_LEVEL_EXTENSION_SIZEThe extension's encoded size in bytes.
  • constAUDIO_LEVEL_SILENCEThe level of digital silence, which a muted source sends (RFC 6464 section 3).

rtci_rtp::extension::corruption_detection_extension

Corruption detection samples (a libwebrtc experiment, W3C webrtc-stats corruptionMeasurements).

rtci_rtp::extension::csrc_audio_level_extension

The audio level of each contributing source of a mixed packet ([RFC 6465]).

  • structCsrcAudioLevelExtensionThe mixer-to-client audio level extension ([RFC 6465]): the level of each contributing source of a mixed packet, in the order of the packet's CSRC list.
  • constCSRC_AUDIO_LEVEL_MAX_COUNTThe most levels one element carries: one per CSRC, and a packet has at most 15 CSRCs (RFC 6465 section 4, RFC 3550 section 5.1).
  • constCSRC_AUDIO_LEVEL_SILENCEThe level of digital silence, and the quietest level there is: -127 dBov.

rtci_rtp::extension::ntp_timestamp_extension

In-band NTP-format timestamps for rapid synchronisation ([RFC 6051] section 3.3).

  • structNtp56ExtensionVariant B (RFC 6051 Figure 6): the low 24 bits of the NTP seconds and the 32 bits of fraction. "RTCP sender reports MUST be used to derive the upper 8 bits of the Seconds" (Ntp56Extension::ntp_time).
  • structNtp64ExtensionVariant A (RFC 6051 Figure 5): a whole 64-bit NTP-format timestamp, 32 bits of seconds then 32 of fraction.
  • constNTP_56_EXTENSION_SIZEThe encoded size of Ntp56Extension.
  • constNTP_56_URIThe URI of Variant B, the 56-bit NTP timestamp (RFC 6051 section 3.3).
  • constNTP_64_EXTENSION_SIZEThe encoded size of Ntp64Extension.
  • constNTP_64_URIThe URI of Variant A, the 64-bit NTP timestamp (RFC 6051 section 3.3).

rtci_rtp::extension::playout_delay_extension

A requested playout-delay range, for latency/smoothness trade-offs.

  • structPlayoutDelayExtensionPlayoutDelayExtension is an extension payload format described in <http://www.webrtc.org/experiments/rtp-hdrext/playout-delay> 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ID | len=2 | MIN delay | MAX delay | …
  • constPLAYOUT_DELAY_EXTENSION_SIZEThe extension's encoded size: two 12-bit values packed into 3 bytes.
  • constPLAYOUT_DELAY_MAX_VALUEThe largest representable delay, in 10 ms units — about 40 seconds.

rtci_rtp::extension::sdes_extension

SDES items in header extensions: MID, RtpStreamId, RepairedRtpStreamId ([RFC 7941], [RFC 8852]).

  • constSDES_ITEM_MAX_LENThe longest SDES item text: the RTCP SDES length field is one octet (RFC 3550 section 6.5).

rtci_rtp::extension::transmission_offset_extension

Transmission time offset ([RFC 5450]).

rtci_rtp::extension::transport_cc_extension

The transport-wide sequence number that TWCC feedback refers to.

  • structTransportCcExtensionTransportCCExtension is a extension payload format in <https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01> 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0xBE | 0xDE | length=1 | …
  • constTRANSPORT_CC_EXTENSION_SIZEThe extension's encoded size in bytes.

rtci_rtp::extension::video_orientation_extension

Camera direction and rotation (CVO), so a receiver can display video upright.

rtci_rtp::header

The RTP header and its extensions.

  • modvalidityThe RTP header validity checks of RFC 3550 Appendix A.1, on raw bytes.
  • structExtensionOne RTP header extension: an id and its payload bytes.
  • structHeaderHeader represents an RTP packet header NOTE: PayloadOffset is populated by Marshal/Unmarshal and should not be modified
  • enumExtensionFormThe form of a header-extension block, as its "defined by profile" field selects it.
  • constCC_MASKBit mask of the CSRC count field.
  • constCSRC_LENGTHLength of each CSRC in bytes.
  • constCSRC_OFFSETByte offset of the first CSRC within the header.
  • constEXTENSION_ID_RESERVEDExtension id 15, reserved by the RFC and never assigned.
  • constEXTENSION_MASKBit mask of the extension flag once shifted.
  • constEXTENSION_PROFILE_ONE_BYTEExtension profile 0xBEDE, which selects one-byte header extension ids ([RFC 8285]).
  • constEXTENSION_PROFILE_TWO_BYTEExtension profile 0x1000, which selects two-byte header extension ids, allowing ids above 14.
  • constEXTENSION_PROFILE_TWO_BYTE_MASKThe bits of "defined by profile" that select the two-byte form. The low four bits are appbits, which a receiver ignores ([RFC 8285] section 4.3).
  • constEXTENSION_SHIFTBit offset of the extension flag.
  • constHEADER_LENGTHThe length of the extension-profile and length fields that precede header extensions.
  • constMARKER_MASKBit mask of the marker bit once shifted.
  • constMARKER_SHIFTBit offset of the marker bit.
  • constONE_BYTE_EXTENSION_MAX_IDThe highest id the one-byte form can carry (RFC 8285 section 4.2).
  • constONE_BYTE_EXTENSION_MAX_LENThe longest element the one-byte form can carry, in bytes.
  • constPADDING_MASKBit mask of the padding flag once shifted.
  • constPADDING_SHIFTBit offset of the padding flag.
  • constPT_MASKBit mask of the payload-type field.
  • constRTP_VERSIONThe RTP version this crate reads and writes (RFC 3550 section 5.1).
  • constSEQ_NUM_LENGTHLength of the sequence number in bytes.
  • constSEQ_NUM_OFFSETByte offset of the sequence number within the header.
  • constSSRC_LENGTHLength of the SSRC in bytes.
  • constSSRC_OFFSETByte offset of the SSRC within the header.
  • constTIMESTAMP_LENGTHLength of the timestamp in bytes.
  • constTIMESTAMP_OFFSETByte offset of the timestamp within the header.
  • constTWO_BYTE_EXTENSION_MAX_LENThe longest element the two-byte form can carry, in bytes.
  • constVERSION_MASKBit mask of the version field once shifted.
  • constVERSION_SHIFTBit offset of the version field in the first header octet.

rtci_rtp::header::validity

The RTP header validity checks of RFC 3550 Appendix A.1, on raw bytes.

  • structRtpLayoutWhere the parts of a valid RTP packet lie.
  • fncheck_rtp_validityApplies the header validity checks of RFC 3550 Appendix A.1 to a datagram.

rtci_rtp::packet

A whole RTP packet: header plus payload.

  • structPacketPacket represents an RTP Packet NOTE: Raw is populated by Marshal/Unmarshal and should not be modified

rtci_rtp::packetizer

Turning encoded frames into RTP packets, and back again.

  • enumMarkerRuleWhich packets of a payload format carry the RTP marker bit. The bit's meaning is the profile's and the payload format's (RFC 3550 section 5.1), so the payloader says.
  • traitDepacketizerDepacketizer depacketizes a RTP payload, removing any RTP specific data from the payload
  • traitPacketizerPacketizer packetizes a payload
  • traitPayloaderPayloader payloads a byte array for use as rtp.Packet payloads
  • fnnew_packetizerBuilds a packetizer for one outbound stream.
  • constRTP_FIXED_HEADER_SIZEBytes of fixed RTP header a packetizer leaves room for in the MTU (RFC 3550 section 5.1).

rtci_rtp::sequence

Sequence-number generation, starting from a random offset as the RFC requires.

  • structSourceSequenceThe per-source sequence number state of RFC 3550 Appendix A.1 (init_seq, update_seq), with the loss arithmetic of Appendix A.3.
  • traitSequencerSequencer generates sequential sequence numbers for building RTP packets
  • fnnew_fixed_sequencerNewFixedSequencer returns a new sequencer starting from a specific sequence number
  • fnnew_random_sequencerNewRandomSequencer returns a new sequencer starting from a random sequence number
  • constMAX_DROPOUTA forward jump smaller than this is loss, not a restart (RFC 3550 Appendix A.1).
  • constMAX_MISORDERA packet this far behind the highest sequence number, or less, is late or a duplicate (RFC 3550 Appendix A.1).
  • constMIN_SEQUENTIALA source is valid once this many packets arrived in sequence (RFC 3550 Appendix A.1).

Generated from the sources of rtci-rtp 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.