pub struct StreamInfo {Show 18 fields
pub ssrc: u32,
pub ssrc_rtx: Option<u32>,
pub ssrc_fec: Option<u32>,
pub payload_type: u8,
pub payload_type_rtx: Option<u8>,
pub payload_type_fec: Option<u8>,
pub rtp_header_extensions: Vec<RTPHeaderExtension>,
pub mime_type: String,
pub clock_rate: u32,
pub channels: u16,
pub sdp_fmtp_line: String,
pub rtcp_feedback: Vec<RTCPFeedback>,
pub mime_type_fec: String,
pub sdp_fmtp_line_fec: String,
pub payload_clock_rates: Vec<(u8, u32)>,
pub initially_paused: bool,
pub section_fmtp_lines: Vec<(u8, String)>,
pub section_mime_types: Vec<(u8, String)>,
}Expand description
Stream context passed to interceptor bind/unbind callbacks.
Contains all relevant information about a media stream (audio or video) when it’s bound to or unbound from an interceptor. This includes codec parameters, SSRC, RTP extensions, and RTCP feedback mechanisms.
Used by Interceptor::bind_local_stream,
Interceptor::unbind_local_stream,
Interceptor::bind_remote_stream, and
Interceptor::unbind_remote_stream.
§Example
use rtci_interceptor::{StreamInfo, RTCPFeedback, RTPHeaderExtension};
let info = StreamInfo {
ssrc: 0x12345678,
clock_rate: 90000,
mime_type: "video/VP8".to_string(),
payload_type: 96,
// Enable NACK for retransmission
rtcp_feedback: vec![RTCPFeedback {
typ: "nack".to_string(),
parameter: String::new(),
}],
..Default::default()
};Fields§
§ssrc: u32Synchronization Source identifier (SSRC) of the stream.
Uniquely identifies the source of an RTP stream within an RTP session.
ssrc_rtx: Option<u32>RTX (Retransmission) SSRC for RFC 4588 retransmission.
When set, retransmissions will use this separate SSRC instead of the original stream’s SSRC. This allows the receiver to distinguish between original and retransmitted packets.
ssrc_fec: Option<u32>FEC (Forward Error Correction) SSRC.
SSRC used for FEC packets if separate-stream FEC is configured.
payload_type: u8RTP payload type (e.g., 96 for VP8, 111 for Opus).
Dynamic payload types (96-127) are typically used for modern codecs.
payload_type_rtx: Option<u8>RTX payload type for RFC 4588 retransmission.
When set along with ssrc_rtx, retransmitted packets will use this
payload type to distinguish them from original packets.
payload_type_fec: Option<u8>FEC payload type.
Payload type used for FEC packets if configured.
rtp_header_extensions: Vec<RTPHeaderExtension>Negotiated RTP header extensions for this stream.
Contains the list of header extensions that can be used with this stream, such as TWCC sequence numbers, audio levels, or video orientation.
mime_type: StringMIME type of the codec (e.g., “video/VP8”, “audio/opus”).
clock_rate: u32Clock rate in Hz (e.g., 90000 for video, 48000 for Opus audio).
Used to convert between RTP timestamps and wall-clock time.
channels: u16Number of audio channels (0 for video, 1 for mono, 2 for stereo).
sdp_fmtp_line: StringFormat-specific parameters from SDP (fmtp line).
Contains codec-specific parameters like “profile-level-id” for H.264 or “minptime” for audio codecs.
rtcp_feedback: Vec<RTCPFeedback>RTCP feedback mechanisms negotiated for this stream.
Specifies which RTCP feedback types (NACK, PLI, REMB, etc.) are supported for this stream.
mime_type_fec: StringMIME type of the FEC format payload_type_fec names (e.g. “video/flexfec-03”,
“video/flexfec”).
It selects the coder: FlexFEC draft-03 (flexfec-03) and RFC 8627 (flexfec) are
different wire formats. Empty means the stream does not say, and the draft-03
interceptors, the only FEC there was before this field, take it as theirs.
sdp_fmtp_line_fec: StringFormat-specific parameters of the FEC format (its a=fmtp line), e.g.
“repair-window=200000”.
payload_clock_rates: Vec<(u8, u32)>The clock rate of each payload type the stream may carry besides payload_type, for a
source that switches payload type (and with it clock rate, RFC 7160 section 4.3), e.g.
Opus at 48000 and PCMU at 8000 on one SSRC. Empty: every packet is at clock_rate.
initially_paused: boolA local stream the session description starts paused (RFC 8853 section 5.2: a rid-id
marked ~, “an unsolicited locally paused stream”). The RFC 7728 interceptor starts
it paused when pause and resume were negotiated for it; other interceptors ignore it.
section_fmtp_lines: Vec<(u8, String)>The a=fmtp parameters of every format of the stream’s m= section by payload type,
repair and redundancy formats included (RTX, RED, ULPFEC, FlexFEC), for an interceptor
that acts on a format the stream does not name itself: the ULPFEC interceptors read
onelevelonly (RFC 5109 section 13) of their ulpfec format here. Empty when the
binder did not say.
section_mime_types: Vec<(u8, String)>The MIME type of every format of the stream’s m= section by payload type, repair and
redundancy formats included, for an interceptor that acts on a format the stream does
not name itself: the RED interceptor finds the section’s red format here (RFC 2198
section 5). For a local stream the peer connection lists them in the order of the
remote description’s m= line, the remote side’s order of preference (RFC 3264 sections
5.1 and 6.1), which decides whether the RED interceptor sends RED. Empty when the
binder did not say.
Implementations§
Source§impl StreamInfo
impl StreamInfo
Sourcepub fn fec_is_flexfec03(&self) -> bool
pub fn fec_is_flexfec03(&self) -> bool
Whether this stream’s FEC flow is FlexFEC draft-03 (<type>/flexfec-03), or does not
name its format.
Sourcepub fn fec_is_ulpfec(&self) -> bool
pub fn fec_is_ulpfec(&self) -> bool
Whether this stream’s FEC flow is ULPFEC as a stream of its own (<type>/ulpfec, RFC
5109 section 14.1, grouped by a=ssrc-group:FEC-FR, RFC 5956 section 4.3).
Sourcepub fn fec_is_flexfec(&self) -> bool
pub fn fec_is_flexfec(&self) -> bool
Whether this stream’s FEC flow is RFC 8627 FlexFEC (<type>/flexfec).