Skip to main content

Peer

Struct Peer 

Source
pub struct Peer<S> { /* private fields */ }
Expand description

RTCPeerConnection representation.

Implementations§

Source§

impl<T> Peer<T>

Source

pub fn member_id(&self) -> &MemberId

Returns ID of Member associated with this Peer.

Source

pub fn id(&self) -> Id

Returns ID of Peer.

Source

pub fn partner_peer_id(&self) -> Id

Returns ID of interconnected Peer.

Source

pub fn partner_member_id(&self) -> &MemberId

Returns ID of interconnected Member.

Source

pub fn local_sdp(&self) -> Option<&str>

Returns SDP offer of this Peer.

Source

pub fn remote_sdp(&self) -> Option<&str>

Returns SDP offer of the partner Peer.

Source

pub fn get_updates(&self) -> Vec<PeerUpdate>

Returns PeerUpdates of this Peer which should be sent to the client in the Event::PeerUpdated.

Source

pub fn new_tracks(&self) -> Vec<Track>

Returns Tracks that remote Peer is not aware of.

Source

pub fn is_sender(&self) -> bool

Indicates whether this Peer has any send tracks.

Source

pub fn is_force_relayed(&self) -> bool

Indicates whether all media is forcibly relayed through a TURN server.

Source

pub fn ice_servers_list(&self) -> Option<Vec<IceServer>>

Returns vector of IceServers built from this Peers IceUser.

Source

pub fn set_ice_user(&mut self, ice_user: IceUser)

Sets IceUser, which is used to generate IceServers

Source

pub fn endpoints(&self) -> Vec<WeakEndpoint>

Returns WeakEndpoints for which this Peer was created.

Source

pub fn add_endpoint(&mut self, endpoint: &Endpoint)

Adds Endpoint for which this Peer was created.

Source

pub fn receivers(&self) -> &HashMap<TrackId, Rc<MediaTrack>>

Returns all receiving MediaTracks of this Peer.

Source

pub fn senders(&self) -> &HashMap<TrackId, Rc<MediaTrack>>

Returns all sending MediaTracks of this Peer.

Source

pub fn force_commit_partner_changes(&mut self)

Forcibly commits all the PeerChange::PartnerTrackPatches.

Source

pub fn inner_force_commit_scheduled_changes(&mut self)

Commits all PeerChanges which are marked as forcible (PeerChange::can_force_apply).

Source

pub fn is_known_to_remote(&self) -> bool

Indicates whether this Peer is known to client (Event::PeerCreated for this Peer was sent to the client).

Source

pub fn is_empty(&self) -> bool

Returns true if this Peer doesn’t have any Send and Recv MediaTracks.

Source

pub fn as_changes_scheduler(&mut self) -> PeerChangesScheduler<'_>

Returns PeerChangesScheduler for this Peer.

Source

pub fn add_ice_candidate(&mut self, ice_candidate: IceCandidate)

Adds the provided IceCandidate to this Peer.

Source

pub fn ice_candidates(&self) -> &HashSet<IceCandidate>

Returns all IceCandidates received for this Peer.

Source

pub fn is_ice_restart(&self) -> bool

Indicates whether an ICE restart should be performed for this Peer.

Source

pub fn negotiation_role(&self) -> Option<NegotiationRole>

Returns the current NegotiationRole of this Peer.

Source

pub fn set_initialized(&mut self)

Marks this Peer as initialized.

Source§

impl Peer<WaitLocalSdp>

Source

pub fn set_local_offer(self, local_sdp: String) -> Peer<WaitRemoteSdp>

Sets local description and transition Peer to WaitRemoteSdp state.

Source

pub fn set_local_answer(self, sdp_answer: String) -> Peer<Stable>

Sets local description and transition Peer to Stable state.

Source

pub fn set_mids( &mut self, mids: HashMap<TrackId, String>, ) -> Result<(), PeerError>

Sets tracks mids.

Provided mids must have entries for all Peers tracks.

§Errors

Errors with PeerError::MidsMismatch if Peer is sending MediaTrack without providing its mid.

Source

pub fn update_senders_statuses(&self, senders_statuses: HashMap<TrackId, bool>)

Updates this Peer’s senders statuses.

Source§

impl Peer<WaitRemoteSdp>

Source

pub fn set_remote_answer(self, sdp_answer: String) -> Peer<Stable>

Sets remote description and transitions Peer to Stable state.

Source

pub fn set_remote_offer(self, sdp_offer: String) -> Peer<WaitLocalSdp>

Sets remote description and transitions Peer to WaitLocalSdp state.

Source§

impl Peer<Stable>

Source

pub fn new( id: Id, member_id: MemberId, partner_peer: Id, partner_member: MemberId, is_force_relayed: bool, peer_updates_sub: Rc<dyn PeerUpdatesSubscriber>, ) -> Self

Creates new Peer for Member.

Source

pub fn start_as_offerer(self) -> Peer<WaitLocalSdp>

Changes Peer state to WaitLocalSdp and discards previously saved SDP Offer and Answer.

Resets Context::local_sdp and Context::remote_sdp.

Source

pub fn start_as_answerer(self) -> Peer<WaitRemoteSdp>

Changes Peer state to WaitLocalSdp and discards previously saved SDP Offer and Answer.

Resets Context::local_sdp and Context::remote_sdp.

Source

pub fn get_mids(&self) -> Result<HashMap<TrackId, String>, PeerError>

Returns mids of this Peer.

§Errors

Errors with PeerError::MidsMismatch if Peer is sending MediaTrack without providing its mid.

Trait Implementations§

Source§

impl<S: Debug> Debug for Peer<S>

Source§

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

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

impl From<Peer<Stable>> for PeerStateMachine

Source§

fn from(peer: Peer<Stable>) -> Self

Converts to this type from the input type.
Source§

impl From<Peer<WaitLocalSdp>> for PeerStateMachine

Source§

fn from(peer: Peer<WaitLocalSdp>) -> Self

Converts to this type from the input type.
Source§

impl From<Peer<WaitRemoteSdp>> for PeerStateMachine

Source§

fn from(peer: Peer<WaitRemoteSdp>) -> Self

Converts to this type from the input type.
Source§

impl<T> PeerChangeHandler for Peer<T>

Source§

fn on_add_send_track(&mut self, track: Rc<MediaTrack>) -> Self::Output

Inserts provided MediaTrack into Context::senders.

Source§

fn on_add_recv_track(&mut self, track: Rc<MediaTrack>) -> Self::Output

Inserts provided MediaTrack into Context::receivers.

Source§

fn on_track_patch(&mut self, patch: TrackPatchEvent) -> Self::Output

Applies provided TrackPatchEvent to Peers Track.

Source§

fn on_partner_track_patch(&mut self, patch: TrackPatchEvent) -> Self::Output

Applies provided TrackPatchEvent that is sourced from this Peers partner Peer to some shared Track.

Source§

fn on_remove_track(&mut self, track_id: TrackId) -> Self::Output

Removes MediaTrack with the provided TrackId from this Peer.

Source§

fn on_ice_restart(&mut self) -> Self::Output

Sets Context::ice_restart flag to true.

Source§

type Output = PeerChange

Output type of all functions from this trait.
Source§

impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitLocalSdp>

Source§

type Error = PeerError

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

fn try_from(peer: &'a PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitRemoteSdp>

Source§

type Error = PeerError

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

fn try_from(peer: &'a PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<Stable>

Source§

type Error = PeerError

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

fn try_from(peer: &'a PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<PeerStateMachine> for Peer<WaitLocalSdp>

Source§

type Error = (PeerError, PeerStateMachine)

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

fn try_from(peer: PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<PeerStateMachine> for Peer<WaitRemoteSdp>

Source§

type Error = (PeerError, PeerStateMachine)

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

fn try_from(peer: PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<PeerStateMachine> for Peer<Stable>

Source§

type Error = (PeerError, PeerStateMachine)

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

fn try_from(peer: PeerStateMachine) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for Peer<S>

§

impl<S> !Send for Peer<S>

§

impl<S> !Sync for Peer<S>

§

impl<S> !UnwindSafe for Peer<S>

§

impl<S> Freeze for Peer<S>
where S: Freeze,

§

impl<S> Unpin for Peer<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Peer<S>
where S: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

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