servo_media_gstreamer::webrtc

Struct GStreamerWebRtcController

source
pub struct GStreamerWebRtcController {
Show 15 fields webrtc: Element, pipeline: Pipeline, delayed_negotiation: bool, thread: WebRtcController, signaller: Box<dyn WebRtcSignaller>, streams: Vec<MediaStreamId>, pending_streams: Vec<MediaStreamId>, pt_counter: i32, request_pad_counter: usize, remote_mline_info: Vec<MLineInfo>, pending_remote_mline_info: Vec<MLineInfo>, remote_offer_generation: u32, _main_loop: MainLoop, data_channels: Arc<Mutex<HashMap<DataChannelId, DataChannelEventTarget>>>, next_data_channel_id: Arc<AtomicUsize>,
}

Fields§

§webrtc: Element§pipeline: Pipeline§delayed_negotiation: bool

We can’t trigger a negotiation-needed event until we have streams, or otherwise a createOffer() call will lead to bad SDP. Instead, we delay negotiation.

§thread: WebRtcController

A handle to the event loop abstraction surrounding the webrtc implementations, which lets gstreamer callbacks send events back to the event loop to run on this object

§signaller: Box<dyn WebRtcSignaller>§streams: Vec<MediaStreamId>

All the streams that are actually connected to the webrtcbin (i.e., their presence has already been negotiated)

§pending_streams: Vec<MediaStreamId>

Disconnected streams that are waiting to be linked. Streams are only linked when:

  • An offer is made (all pending streams are flushed)
  • An offer is received (all matching pending streams are flushed)
  • A stream is added when there is a so-far-disconnected remote-m-line

In other words, these are all yet to be negotiated

See link_stream

§pt_counter: i32

Each new webrtc stream should have a new payload/pt value, starting at 96

This is maintained as a known yet-unused payload number, being incremented whenever we use it, and set to (remote_pt + 1) if the remote sends us a stream with a higher pt

§request_pad_counter: usize

We keep track of how many request pads have been created on webrtcbin so that we can request more to fill in the gaps and acquire a specific pad if necessary

§remote_mline_info: Vec<MLineInfo>

Streams need to be connected to the relevant sink pad, and we figure this out by keeping track of the caps of each m-line in the SDP.

§pending_remote_mline_info: Vec<MLineInfo>

Temporary storage for remote_mline_info until the remote description is applied

Without this, a unluckily timed call to link_stream() may happen before the webrtcbin knows the remote description, but while we think it does

§remote_offer_generation: u32

In case we get multiple remote offers, this lets us keep track of which is the newest

§_main_loop: MainLoop§data_channels: Arc<Mutex<HashMap<DataChannelId, DataChannelEventTarget>>>§next_data_channel_id: Arc<AtomicUsize>

Implementations§

source§

impl GStreamerWebRtcController

source

fn set_description( &mut self, desc: SessionDescription, description_type: DescriptionType, cb: Box<dyn FnOnce() + Send + 'static>, ) -> WebRtcResult

source

fn store_remote_mline_info(&mut self, sdp: &SDPMessage)

Streams need to be linked to the correct pads, so we buffer them up until we know enough to do this.

When we get a remote offer, we store the relevant m-line information so that we can pick the correct sink pad and payload. Shortly after we look for any pending streams and connect them to available compatible m-lines using link_stream.

When we create an offer, we’re controlling the pad order, so we set request_new_pads to true and forcefully link all pending streams before generating the offer.

When request_new_pads is false, we may still request new pads, however we only do this for streams that have already been negotiated by the remote.

source

fn flush_pending_streams(&mut self, request_new_pads: bool) -> WebRtcResult

link_stream, but for all pending streams

source

fn start_pipeline(&mut self) -> WebRtcResult

Trait Implementations§

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

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T