Struct medea_jason::peer::MediaConnections [−][src]
Storage of RtcPeerConnection
’s sender::Component
and
receiver::Component
.
Implementations
impl MediaConnections
[src]
pub fn new(
peer: Rc<RtcPeerConnection>,
peer_events_sender: UnboundedSender<PeerEvent>
) -> Self
[src]
peer: Rc<RtcPeerConnection>,
peer_events_sender: UnboundedSender<PeerEvent>
) -> Self
Instantiates new MediaConnections
storage for a given
RtcPeerConnection
.
pub fn get_transceivers_sides(
&self,
kind: MediaKind,
direction: TrackDirection,
source_kind: Option<MediaSourceKind>
) -> Vec<Rc<dyn TransceiverSide>>
[src]
&self,
kind: MediaKind,
direction: TrackDirection,
source_kind: Option<MediaSourceKind>
) -> Vec<Rc<dyn TransceiverSide>>
Returns all Sender
s and Receiver
s from this MediaConnections
with provided MediaKind
, TrackDirection
and
MediaSourceKind
.
#[must_use]pub fn is_all_tracks_in_media_state(
&self,
kind: MediaKind,
direction: TrackDirection,
source_kind: Option<MediaSourceKind>,
state: MediaState
) -> bool
[src]
&self,
kind: MediaKind,
direction: TrackDirection,
source_kind: Option<MediaSourceKind>,
state: MediaState
) -> bool
Indicates whether all TransceiverSide
s with provided MediaKind
,
TrackDirection
and MediaSourceKind
is in the provided
MediaExchangeState
.
pub fn get_mids(
&self
) -> Result<HashMap<TrackId, String>, Traced<MediaConnectionsError>>
[src]
&self
) -> Result<HashMap<TrackId, String>, Traced<MediaConnectionsError>>
Returns mapping from a proto::Track
ID to a mid
of this track’s
RtcRtpTransceiver
.
Errors
Errors with MediaConnectionsError::SendersWithoutMid
if some
Sender
doesn’t have mid.
Errors with MediaConnectionsError::ReceiversWithoutMid
if some
Receiver
doesn’t have mid.
pub fn get_transceivers_statuses(&self) -> HashMap<TrackId, bool>
[src]
Returns activity statuses of the all Sender
s and Receiver
s from
this MediaConnections
.
pub fn get_transceiver_side_by_id(
&self,
track_id: TrackId
) -> Option<Rc<dyn TransceiverSide>>
[src]
&self,
track_id: TrackId
) -> Option<Rc<dyn TransceiverSide>>
Returns Rc
to TransceiverSide
with a provided TrackId
.
Returns None
if TransceiverSide
with a provided TrackId
doesn’t exists in this MediaConnections
.
pub fn insert_sender(&self, sender: Component)
[src]
Inserts new sender::Component
into MediaConnections
.
pub fn insert_receiver(&self, receiver: Component)
[src]
Inserts new receiver::Component
into MediaConnections
.
pub fn get_tracks_request(
&self,
kinds: LocalStreamUpdateCriteria
) -> Option<TracksRequest>
[src]
&self,
kinds: LocalStreamUpdateCriteria
) -> Option<TracksRequest>
Returns TracksRequest
based on Sender
s in this
MediaConnections
. Sender
s are chosen based on provided
LocalStreamUpdateCriteria
.
pub async fn insert_local_tracks(
&self,
tracks: &HashMap<TrackId, Rc<Track>>
) -> Result<HashMap<TrackId, Stable>, Traced<MediaConnectionsError>>
[src]
&self,
tracks: &HashMap<TrackId, Rc<Track>>
) -> Result<HashMap<TrackId, Stable>, Traced<MediaConnectionsError>>
Inserts provided tracks into Sender
s based on track IDs.
local::Track
s are inserted into Sender
’s RtcRtpTransceiver
s
via replaceTrack
method, changing its direction to sendonly
.
Returns HashMap
with media_exchange_state::Stable
s updates for
the Sender
s.
Errors
With MediaConnectionsError::InvalidMediaTracks
if provided
HashMap
doesn’t contain required local::Track
.
With MediaConnectionsError::InvalidMediaTrack
if some
local::Track
cannot be inserted into associated Sender
because
of constraints mismatch.
With MediaConnectionsError::CouldNotInsertLocalTrack
if some
local::Track
cannot be inserted into provided Sender
s
transceiver.
pub fn add_remote_track(
&self,
track_event: &RtcTrackEvent
) -> Result<(), Traced<MediaConnectionsError>>
[src]
&self,
track_event: &RtcTrackEvent
) -> Result<(), Traced<MediaConnectionsError>>
Handles RtcTrackEvent
by adding new track to the corresponding
Receiver
.
Returns ID of associated Sender
and provided track TrackId
, if
any.
Errors
Errors with MediaConnectionsError::CouldNotInsertRemoteTrack
if
could not find Receiver
by transceivers mid
.
Panics
If Transceiver
from the provided RtcTrackEvent
doesn’t have a
mid
. Not supposed to happen, since RtcTrackEvent
is only fired
when a Transceiver
is negotiated, thus have a mid
.
pub fn sync_receivers(&self)
[src]
Iterates over all Receiver
s with mid
and without
Transceiver
, trying to find the corresponding Transceiver
in
RtcPeerConnection
and to insert it into the Receiver
.
pub fn get_senders_without_tracks_ids(
&self,
kinds: LocalStreamUpdateCriteria
) -> Vec<TrackId>
[src]
&self,
kinds: LocalStreamUpdateCriteria
) -> Vec<TrackId>
Returns all Sender
s which are matches provided
LocalStreamUpdateCriteria
and doesn’t have local::Track
.
pub async fn drop_send_tracks(&self, kinds: LocalStreamUpdateCriteria)
[src]
Drops local::Track
s of all Sender
s which are matches provided
LocalStreamUpdateCriteria
.
pub fn remove_track(&self, track_id: TrackId)
[src]
Removes a sender::Component
or a receiver::Component
with the
provided TrackId
from these MediaConnections
.
Auto Trait Implementations
impl !RefUnwindSafe for MediaConnections
impl !Send for MediaConnections
impl !Sync for MediaConnections
impl Unpin for MediaConnections
impl !UnwindSafe for MediaConnections
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.