Skip to main content

RtpRewriteRule

Struct RtpRewriteRule 

Source
pub struct RtpRewriteRule {
    pub match_payload_type: Option<u8>,
    pub fixed_out_ssrc: Option<u32>,
    pub ssrc_offset: u32,
    pub out_payload_type: Option<u8>,
    pub sdes_mid_extension_id: Option<u8>,
    pub sdes_mid: Option<String>,
}
Expand description

A single payload-type-scoped rewrite rule for the RTP rewrite bridge.

The bridge rewrites every forwarded packet using the most specific match: a rule whose match_payload_type equals the packet’s payload type wins; otherwise the single rule with match_payload_type: None acts as the catch-all. Audio-only relays install one catch-all rule; video relays add one rule per m-line payload type so audio, video and DTMF each get their own destination SSRC / payload type (the legacy single-param bridge rewrote every packet — audio AND video — to one SSRC/PT, which corrupted video).

Fields§

§match_payload_type: Option<u8>

When Some(pt), only packets carrying this payload type are rewritten. When None, this is the catch-all rule applied to any other packet.

§fixed_out_ssrc: Option<u32>

Fixed SSRC written on rewritten packets. Defaults to src_ssrc + ssrc_offset when None.

§ssrc_offset: u32

SSRC offset applied when fixed_out_ssrc is None.

§out_payload_type: Option<u8>

Replacement payload type, or None to keep the original.

§sdes_mid_extension_id: Option<u8>

SDES-MID RTP header extension id (the extmap id negotiated for urn:ietf:params:rtp-hdrext:sdes:mid). When set together with Self::sdes_mid, packets rewritten by this rule get the MID extension stamped so a WebRTC receiver (Chrome) can attribute them to the negotiated track regardless of SSRC. Payload-type-scoped: audio/DTMF rules carry the audio m-line’s mid, video rules the video m-line’s mid. Only written when the bridge’s RtpRewriteBridgeOptions::strip_extensions is false.

§sdes_mid: Option<String>

The destination leg’s MID value for this m-line (e.g. “0” for the audio m-line, “1” for video).

Implementations§

Source§

impl RtpRewriteRule

Source

pub fn catch_all(params: RtpRewriteBridgeParams) -> Self

The catch-all rule mirroring the legacy single-params behavior.

Source

pub fn dtmf(src_pt: u8, dst_pt: u8, params: RtpRewriteBridgeParams) -> Self

DTMF remap: rewrite a specific source PT to a destination PT while inheriting the same SSRC rewrite as the catch-all rule.

Source

pub fn from_params(params: RtpRewriteBridgeParams) -> Vec<Self>

Convert the legacy params into the rule list they map to: a catch-all rule plus, when DTMF remapping is configured, a DTMF rule. This is the single place that interprets the legacy struct, keeping the rewrite path itself rule-table-only.

Trait Implementations§

Source§

impl Clone for RtpRewriteRule

Source§

fn clone(&self) -> RtpRewriteRule

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 RtpRewriteRule

Source§

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

Formats the value using the given formatter. Read more

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more