pub struct Peer<S> { /* private fields */ }Expand description
RTCPeerConnection representation.
Implementations§
Source§impl<T> Peer<T>
impl<T> Peer<T>
Sourcepub fn partner_peer_id(&self) -> Id
pub fn partner_peer_id(&self) -> Id
Returns ID of interconnected Peer.
Sourcepub fn partner_member_id(&self) -> &MemberId
pub fn partner_member_id(&self) -> &MemberId
Returns ID of interconnected Member.
Sourcepub fn remote_sdp(&self) -> Option<&str>
pub fn remote_sdp(&self) -> Option<&str>
Returns SDP offer of the partner Peer.
Sourcepub fn get_updates(&self) -> Vec<PeerUpdate>
pub fn get_updates(&self) -> Vec<PeerUpdate>
Returns PeerUpdates of this Peer which should be sent to the
client in the Event::PeerUpdated.
Sourcepub fn is_force_relayed(&self) -> bool
pub fn is_force_relayed(&self) -> bool
Indicates whether all media is forcibly relayed through a TURN server.
Sourcepub fn ice_servers_list(&self) -> Option<Vec<IceServer>>
pub fn ice_servers_list(&self) -> Option<Vec<IceServer>>
Sourcepub fn set_ice_user(&mut self, ice_user: IceUser)
pub fn set_ice_user(&mut self, ice_user: IceUser)
Sourcepub fn endpoints(&self) -> Vec<WeakEndpoint>
pub fn endpoints(&self) -> Vec<WeakEndpoint>
Returns WeakEndpoints for which this Peer was created.
Sourcepub fn add_endpoint(&mut self, endpoint: &Endpoint)
pub fn add_endpoint(&mut self, endpoint: &Endpoint)
Sourcepub fn receivers(&self) -> &HashMap<TrackId, Rc<MediaTrack>>
pub fn receivers(&self) -> &HashMap<TrackId, Rc<MediaTrack>>
Returns all receiving MediaTracks of this Peer.
Sourcepub fn senders(&self) -> &HashMap<TrackId, Rc<MediaTrack>>
pub fn senders(&self) -> &HashMap<TrackId, Rc<MediaTrack>>
Returns all sending MediaTracks of this Peer.
Sourcepub fn force_commit_partner_changes(&mut self)
pub fn force_commit_partner_changes(&mut self)
Forcibly commits all the PeerChange::PartnerTrackPatches.
Sourcepub fn inner_force_commit_scheduled_changes(&mut self)
pub fn inner_force_commit_scheduled_changes(&mut self)
Commits all PeerChanges which are marked as forcible
(PeerChange::can_force_apply).
Sourcepub fn is_known_to_remote(&self) -> bool
pub fn is_known_to_remote(&self) -> bool
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this Peer doesn’t have any Send and Recv
MediaTracks.
Sourcepub fn as_changes_scheduler(&mut self) -> PeerChangesScheduler<'_>
pub fn as_changes_scheduler(&mut self) -> PeerChangesScheduler<'_>
Returns PeerChangesScheduler for this Peer.
Sourcepub fn add_ice_candidate(&mut self, ice_candidate: IceCandidate)
pub fn add_ice_candidate(&mut self, ice_candidate: IceCandidate)
Adds the provided IceCandidate to this Peer.
Sourcepub fn ice_candidates(&self) -> &HashSet<IceCandidate>
pub fn ice_candidates(&self) -> &HashSet<IceCandidate>
Returns all IceCandidates received for this Peer.
Sourcepub fn is_ice_restart(&self) -> bool
pub fn is_ice_restart(&self) -> bool
Indicates whether an ICE restart should be performed for this Peer.
Sourcepub fn negotiation_role(&self) -> Option<NegotiationRole>
pub fn negotiation_role(&self) -> Option<NegotiationRole>
Returns the current NegotiationRole of this Peer.
Sourcepub fn set_initialized(&mut self)
pub fn set_initialized(&mut self)
Marks this Peer as initialized.
Source§impl Peer<WaitLocalSdp>
impl Peer<WaitLocalSdp>
Sourcepub fn set_local_offer(self, local_sdp: String) -> Peer<WaitRemoteSdp>
pub fn set_local_offer(self, local_sdp: String) -> Peer<WaitRemoteSdp>
Sets local description and transition Peer to WaitRemoteSdp
state.
Sourcepub fn set_local_answer(self, sdp_answer: String) -> Peer<Stable>
pub fn set_local_answer(self, sdp_answer: String) -> Peer<Stable>
Source§impl Peer<WaitRemoteSdp>
impl Peer<WaitRemoteSdp>
Sourcepub fn set_remote_answer(self, sdp_answer: String) -> Peer<Stable>
pub fn set_remote_answer(self, sdp_answer: String) -> Peer<Stable>
Sourcepub fn set_remote_offer(self, sdp_offer: String) -> Peer<WaitLocalSdp>
pub fn set_remote_offer(self, sdp_offer: String) -> Peer<WaitLocalSdp>
Sets remote description and transitions Peer to WaitLocalSdp
state.
Source§impl Peer<Stable>
impl Peer<Stable>
Sourcepub fn new(
id: Id,
member_id: MemberId,
partner_peer: Id,
partner_member: MemberId,
is_force_relayed: bool,
peer_updates_sub: Rc<dyn PeerUpdatesSubscriber>,
) -> Self
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
Sourcepub fn start_as_offerer(self) -> Peer<WaitLocalSdp>
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.
Sourcepub fn start_as_answerer(self) -> Peer<WaitRemoteSdp>
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.
Trait Implementations§
Source§impl From<Peer<WaitLocalSdp>> for PeerStateMachine
impl From<Peer<WaitLocalSdp>> for PeerStateMachine
Source§fn from(peer: Peer<WaitLocalSdp>) -> Self
fn from(peer: Peer<WaitLocalSdp>) -> Self
Source§impl From<Peer<WaitRemoteSdp>> for PeerStateMachine
impl From<Peer<WaitRemoteSdp>> for PeerStateMachine
Source§fn from(peer: Peer<WaitRemoteSdp>) -> Self
fn from(peer: Peer<WaitRemoteSdp>) -> Self
Source§impl<T> PeerChangeHandler for Peer<T>
impl<T> PeerChangeHandler for Peer<T>
Source§fn on_add_send_track(&mut self, track: Rc<MediaTrack>) -> Self::Output
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
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
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
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
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
fn on_ice_restart(&mut self) -> Self::Output
Sets Context::ice_restart flag to true.
Source§type Output = PeerChange
type Output = PeerChange
Source§impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitLocalSdp>
impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitLocalSdp>
Source§impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitRemoteSdp>
impl<'a> TryFrom<&'a PeerStateMachine> for &'a Peer<WaitRemoteSdp>
Source§impl TryFrom<PeerStateMachine> for Peer<WaitLocalSdp>
impl TryFrom<PeerStateMachine> for Peer<WaitLocalSdp>
Source§impl TryFrom<PeerStateMachine> for Peer<WaitRemoteSdp>
impl TryFrom<PeerStateMachine> for Peer<WaitRemoteSdp>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request