Skip to main content

StreamInfo

Struct StreamInfo 

Source
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: u32

Synchronization 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: u8

RTP 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: String

MIME type of the codec (e.g., “video/VP8”, “audio/opus”).

§clock_rate: u32

Clock rate in Hz (e.g., 90000 for video, 48000 for Opus audio).

Used to convert between RTP timestamps and wall-clock time.

§channels: u16

Number of audio channels (0 for video, 1 for mono, 2 for stereo).

§sdp_fmtp_line: String

Format-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: String

MIME 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: String

Format-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: bool

A 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

Source

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.

Source

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).

Source

pub fn fec_is_flexfec(&self) -> bool

Whether this stream’s FEC flow is RFC 8627 FlexFEC (<type>/flexfec).

Trait Implementations§

Source§

impl Clone for StreamInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for StreamInfo

Source§

impl PartialEq for StreamInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StreamInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.