Skip to main content

RoomState

Struct RoomState 

Source
pub struct RoomState {
    pub(super) admission_policy: RoomAdmissionPolicy,
    pub media_limits: RoomMediaLimits,
    pub video_adaptation_tuning: VideoAdaptationTuning,
    pub users: BTreeMap<UserId, ActiveUser>,
    pub(super) next_connection_id: u64,
    pub next_consumer_id: u64,
    next_track_snapshot_revision: u64,
    pub(super) recording_state: RecordingState,
    pub(in engine::room) staged_publishes: StagedPublishes,
    pub(in engine::room) topology: RoomTopology,
}

Fields§

§admission_policy: RoomAdmissionPolicy§media_limits: RoomMediaLimits§video_adaptation_tuning: VideoAdaptationTuning§users: BTreeMap<UserId, ActiveUser>§next_connection_id: u64

rejects stale async callbacks from previous connections

§next_consumer_id: u64§next_track_snapshot_revision: u64§recording_state: RecordingState§staged_publishes: StagedPublishes§topology: RoomTopology

Implementations§

Source§

impl RoomState

Source

pub fn commit_declared_consumer_setup( &mut self, setup: DeclaredConsumerSetup, origin: ConsumerSetupOrigin, ) -> ConsumerSetupOutcome

Commits a transport-declared consumer route.

Returns ConsumerSetupOutcome::Released when receiver or source identity changed during declaration or the router rejects the dependency.

Source

pub fn release_pending_consumer_setup( &mut self, setup: PendingConsumerSetup, ) -> Vec<TransportRelayRouteEffect>

Source§

impl RoomState

Source

pub fn apply_publish_intent( &mut self, user_id: &UserId, publisher_connection_id: ConnectionId, intent: &SourcePublishIntent, can_stage: bool, ) -> PublishIntentPlan

Source

pub fn validate_publish( &self, user_id: &UserId, publisher_connection_id: ConnectionId, intent: &SourcePublishIntent, ) -> Option<ValidatedPublish>

Source

pub fn commit_publish_reservation( &mut self, publish: ValidatedPublish, consumable_rtp_parameters: RouterRtpParameters, upload_encodings: &[SessionUploadEncoding], transport_media_id: TransportMediaId, ) -> Option<PublishCommit>

Source

pub(in engine::room) fn validate_publish_commit( &self, publish: &ValidatedPublish, transport_media_id: TransportMediaId, ) -> Option<()>

Source

pub fn producer_stream_id_for_transport_media_id( &self, transport_media_id: TransportMediaId, ) -> Option<UserStreamId>

Source

pub fn published_source_id( &self, owner: &UserId, connection: ConnectionId, stream: &UserStreamId, ) -> Option<PublishedSourceId>

Source

pub fn apply_publication_activity( &mut self, user_id: &UserId, connection_id: ConnectionId, stream_id: &UserStreamId, active: bool, presence: Option<&UserInfo>, ) -> Result<ProducerActivityCommit, ProducerActivityRejection>

Source§

impl RoomState

Source

pub fn apply_receiver_intent( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> Option<ReceiverRouteCommit>

Source

fn plan_receiver_intent_change( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> ReceiverRouteWork

Source

pub fn refresh_consumer_readiness( &mut self, user_id: &UserId, connection_id: ConnectionId, declined_consumers: &[TransportMediaId], ) -> Option<ReceiverRouteCommit>

Source

pub(super) fn plan_missing_receiver_routes( &mut self, scope: ReceiverRouteScope<'_>, ) -> ReceiverRouteWork

Source

fn plan_consumers( &mut self, targets: Vec<ConsumerSetupTarget>, ) -> Vec<PendingConsumerSetup>

Source

fn setup_rank( &self, target: &ConsumerSetupTarget, active_speakers: &BTreeSet<UserId>, ) -> VideoAdmissionRank

Source

fn apply_route_updates( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> (Vec<ReceiverRouteActivity>, Vec<TransportRelayRouteEffect>)

Source

fn missing_receiver_route_targets( &mut self, scope: ReceiverRouteScope<'_>, ) -> Vec<ConsumerSetupTarget>

Source

fn plan_consumer( &mut self, target: ConsumerSetupTarget, ) -> Option<PendingConsumerSetup>

Source

pub(super) fn setup_selection( &self, target: &ConsumerSetupTarget, source_active: bool, ) -> ConsumerSourceSelection

Source

fn apply_initial_receiver_deafened( &self, target: &ConsumerSetupTarget, selection: ConsumerSourceSelection, ) -> ConsumerSourceSelection

Source

fn apply_initial_video_download_cap( &self, target: &ConsumerSetupTarget, source_active: bool, selection: ConsumerSourceSelection, ) -> ConsumerSourceSelection

Source

fn active_video_count(&self, consumer_user_id: &UserId) -> usize

Source§

impl RoomState

Source

pub(in engine::room) fn receiver_video_layout_role( &self, consumer_user_id: &UserId, source: &PublishedSourceDescriptor, active_speaker_source_user_ids: &BTreeSet<UserId>, ) -> SourceRoomPolicySelector

Source

pub(in engine::room) fn diagnostics_video_layout_role( &self, consumer_user_id: &UserId, source: &PublishedSourceDescriptor, ) -> Option<SourceRoomPolicySelector>

Source§

impl RoomState

Source

pub fn fanout_all(&self, message: &RoomEventMessage) -> MessageFanout

Source

pub fn fanout_all_except( &self, message: &RoomEventMessage, excluded_user_id: &UserId, ) -> MessageFanout

Source

fn apply_join_routing( &mut self, user_id: &UserId, connection_id: ConnectionId, is_new: bool, home_placement: RouterPlacement, ) -> Result<SessionPlacementCommit, RoomJoinError>

Source

fn install_joined_session( &mut self, user_id: &UserId, permissions: RoomUserPermissions, sender: UserOutboundSender, connection_id: ConnectionId, ) -> Option<UserOutboundSender>

Source

pub fn apply_join_on_placement( &mut self, user_id: &UserId, permissions: impl Into<RoomUserPermissions>, sender: UserOutboundSender, joined_fanout: UserJoinedFanout, home_placement: RouterPlacement, ) -> Result<JoinCommit, RoomJoinError>

Source

fn remove_runtime_user( &mut self, user_id: &UserId, ) -> Option<(ActiveUser, RoomTransportPlan)>

Source

pub fn close_connection( &mut self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<ConnectionCloseCommit>

Source

pub fn apply_presence_update( &mut self, user_id: &UserId, connection_id: ConnectionId, info: &UserInfo, ) -> Option<PresenceCommit>

Source

pub fn set_user_negotiated( &mut self, user_id: &UserId, connection_id: ConnectionId, capabilities: MediaCapabilities, ) -> Option<bool>

Source

pub fn apply_disconnect_users( &mut self, user_ids: &[UserId], ) -> DisconnectCommit

Source

pub fn broadcast_fanout( &self, user_id: &UserId, connection_id: ConnectionId, message: Value, ) -> Result<Option<MessageFanout>, BroadcastPayloadError>

Plans a broadcast to every current user except user_id.

Returns Ok(None) when connection_id is missing or stale for user_id.

§Errors

Returns BroadcastPayloadError::TooLarge when the serialized payload exceeds the room broadcast limit. Returns BroadcastPayloadError::JsonSerialization when JSON serialization fails.

Source§

impl RoomState

Source

pub fn new( runtime_context: &RoomRuntimeContext, admission_policy: RoomAdmissionPolicy, media_limits: RoomMediaLimits, video_adaptation_tuning: VideoAdaptationTuning, router_rtp_capabilities: MediaCapabilities, ) -> Self

Source

pub fn user_for_connection( &self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<&ActiveUser>

Source

pub fn user_mut_for_connection( &mut self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<&mut ActiveUser>

Source

pub fn recording_state(&self) -> RecordingState

Source

pub fn transport_user_entries( &self, ) -> impl Iterator<Item = (&UserId, ConnectionId)>

Source

pub fn transport_user_key( &self, user_id: &UserId, connection_id: ConnectionId, ) -> TransportSessionKey

Returns the transport key for an exact committed router placement.

Use Self::committed_transport_user_key when placement may be stale.

§Panics

Panics when user_id and connection_id have no committed router placement.

Source

pub fn committed_transport_user_key( &self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<TransportSessionKey>

Returns None unless the exact router placement remains committed.

Source

pub fn placement_usage_snapshot(&self) -> PlacementSnapshot

Source

pub fn assigned_primary_media_worker_id(&self) -> Option<MediaWorkerId>

Source

pub(in engine::room) fn committed_consumer_routes( &self, ) -> impl Iterator<Item = ConsumerRouteView<'_>>

Source

pub fn user_connection_id(&self, user_id: &UserId) -> Option<ConnectionId>

Source

pub fn user_count(&self) -> usize

Source

pub fn user_snapshots_except( &self, excluded_user_id: &UserId, ) -> Vec<PeerSnapshot>

Source

pub fn user_info_snapshot(&self, user_id: &UserId) -> Option<(UserId, UserInfo)>

Source

pub(in engine::room) fn remote_track_snapshot_for_user( &mut self, user_id: &UserId, requires_negotiation: bool, ) -> VersionedRemoteTrackSnapshot

Source

pub(in engine::room) fn remote_track_snapshots_for_users( &mut self, user_ids: BTreeSet<UserId>, requires_negotiation: bool, ) -> Vec<(UserOutboundSender, VersionedRemoteTrackSnapshot)>

Source

pub fn user_stats_counts(&self) -> (u64, BTreeMap<UserStreamId, u64>)

Source

pub fn media_counts(&self) -> RoomMediaCounts

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for RoomState

Source§

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

Formats the value using the given formatter. Read more

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.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

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

§

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

§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

§

impl<T> CryptoSafe for T

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

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