Struct str0m::media::MediaData

source ·
pub struct MediaData {
    pub mid: Mid,
    pub pt: Pt,
    pub rid: Option<Rid>,
    pub params: PayloadParams,
    pub time: MediaTime,
    pub network_time: Instant,
    pub contiguous: bool,
    pub data: Vec<u8>,
    pub ext_vals: ExtensionValues,
    pub meta: Vec<RtpMeta>,
    pub codec_extra: CodecExtra,
}
Expand description

Video or audio data from the remote peer.

This is obtained via Event::MediaData.

Fields§

§mid: Mid

Identifier of the m-line in the SDP this media belongs to.

§pt: Pt

Payload type (PT) tells which negotiated codec is being used. An m-line can carry different codecs, the payload type can theoretically change from one packet to the next.

§rid: Option<Rid>

Rtp Stream Id (RID) identifies an RTP stream without refering to its Synchronization Source (SSRC).

This is a newer standard that is sometimes used in WebRTC to identify a stream. Specifically when using Simulcast in Chrome.

§params: PayloadParams

Parameters for the codec. This is used to match incoming PT to ougoing PT.

§time: MediaTime

The RTP media time of this packet. Media time is described as a nominator/denominator quantity. The nominator is the timestamp field from the RTP header, the denominator depends on whether this is an audio or video packet.

For audio the timebase is 48kHz for video it is 90kHz.

§network_time: Instant

The time of the Input::Receive that caused this MediaData.

In simple SFU setups this can be used as wallclock for Writer::write.

§contiguous: bool

Whether the data is contiguous from the one just previously emitted. If this is false, we got an interruption in RTP packets, and the data may or may not be usable in a decoder without requesting a new keyframe.

For audio this flag most likely doesn’t matter.

§data: Vec<u8>

The actual packet data a.k.a Sample.

Bigger samples don’t fit in one UDP packet, thus WebRTC RTP is chopping up codec transmission units into smaller parts.

This data is a full depacketized Sample.

§ext_vals: ExtensionValues

RTP header extensions for this media data. This is taken from the first RTP header.

§meta: Vec<RtpMeta>

The individual packet metadata that were part of making the Sample in data.

§codec_extra: CodecExtra

Additional codec specific information

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more