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: u64rejects stale async callbacks from previous connections
next_consumer_id: u64§next_track_snapshot_revision: u64§recording_state: RecordingState§staged_publishes: StagedPublishes§topology: RoomTopologyImplementations§
Source§impl RoomState
impl RoomState
Sourcepub fn commit_declared_consumer_setup(
&mut self,
setup: DeclaredConsumerSetup,
origin: ConsumerSetupOrigin,
) -> ConsumerSetupOutcome
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.
pub fn release_pending_consumer_setup( &mut self, setup: PendingConsumerSetup, ) -> Vec<TransportRelayRouteEffect>
Source§impl RoomState
impl RoomState
pub fn apply_publish_intent( &mut self, user_id: &UserId, publisher_connection_id: ConnectionId, intent: &SourcePublishIntent, can_stage: bool, ) -> PublishIntentPlan
pub fn validate_publish( &self, user_id: &UserId, publisher_connection_id: ConnectionId, intent: &SourcePublishIntent, ) -> Option<ValidatedPublish>
pub fn commit_publish_reservation( &mut self, publish: ValidatedPublish, consumable_rtp_parameters: RouterRtpParameters, upload_encodings: &[SessionUploadEncoding], transport_media_id: TransportMediaId, ) -> Option<PublishCommit>
pub(in engine::room) fn validate_publish_commit( &self, publish: &ValidatedPublish, transport_media_id: TransportMediaId, ) -> Option<()>
pub fn producer_stream_id_for_transport_media_id( &self, transport_media_id: TransportMediaId, ) -> Option<UserStreamId>
pub fn published_source_id( &self, owner: &UserId, connection: ConnectionId, stream: &UserStreamId, ) -> Option<PublishedSourceId>
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
impl RoomState
pub fn apply_receiver_intent( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> Option<ReceiverRouteCommit>
fn plan_receiver_intent_change( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> ReceiverRouteWork
pub fn refresh_consumer_readiness( &mut self, user_id: &UserId, connection_id: ConnectionId, declined_consumers: &[TransportMediaId], ) -> Option<ReceiverRouteCommit>
pub(super) fn plan_missing_receiver_routes( &mut self, scope: ReceiverRouteScope<'_>, ) -> ReceiverRouteWork
fn plan_consumers( &mut self, targets: Vec<ConsumerSetupTarget>, ) -> Vec<PendingConsumerSetup>
fn setup_rank( &self, target: &ConsumerSetupTarget, active_speakers: &BTreeSet<UserId>, ) -> VideoAdmissionRank
fn apply_route_updates( &mut self, user_id: &UserId, connection_id: ConnectionId, target_user_id: &UserId, intents: &BTreeMap<UserStreamId, SourceSubscriptionIntent>, ) -> (Vec<ReceiverRouteActivity>, Vec<TransportRelayRouteEffect>)
fn missing_receiver_route_targets( &mut self, scope: ReceiverRouteScope<'_>, ) -> Vec<ConsumerSetupTarget>
fn plan_consumer( &mut self, target: ConsumerSetupTarget, ) -> Option<PendingConsumerSetup>
pub(super) fn setup_selection( &self, target: &ConsumerSetupTarget, source_active: bool, ) -> ConsumerSourceSelection
fn apply_initial_receiver_deafened( &self, target: &ConsumerSetupTarget, selection: ConsumerSourceSelection, ) -> ConsumerSourceSelection
fn apply_initial_video_download_cap( &self, target: &ConsumerSetupTarget, source_active: bool, selection: ConsumerSourceSelection, ) -> ConsumerSourceSelection
fn active_video_count(&self, consumer_user_id: &UserId) -> usize
Source§impl RoomState
impl RoomState
pub(in engine::room) fn receiver_video_layout_role( &self, consumer_user_id: &UserId, source: &PublishedSourceDescriptor, active_speaker_source_user_ids: &BTreeSet<UserId>, ) -> SourceRoomPolicySelector
pub(in engine::room) fn diagnostics_video_layout_role( &self, consumer_user_id: &UserId, source: &PublishedSourceDescriptor, ) -> Option<SourceRoomPolicySelector>
Source§impl RoomState
impl RoomState
pub fn fanout_all(&self, message: &RoomEventMessage) -> MessageFanout
pub fn fanout_all_except( &self, message: &RoomEventMessage, excluded_user_id: &UserId, ) -> MessageFanout
fn apply_join_routing( &mut self, user_id: &UserId, connection_id: ConnectionId, is_new: bool, home_placement: RouterPlacement, ) -> Result<SessionPlacementCommit, RoomJoinError>
fn install_joined_session( &mut self, user_id: &UserId, permissions: RoomUserPermissions, sender: UserOutboundSender, connection_id: ConnectionId, ) -> Option<UserOutboundSender>
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>
fn remove_runtime_user( &mut self, user_id: &UserId, ) -> Option<(ActiveUser, RoomTransportPlan)>
pub fn close_connection( &mut self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<ConnectionCloseCommit>
pub fn apply_presence_update( &mut self, user_id: &UserId, connection_id: ConnectionId, info: &UserInfo, ) -> Option<PresenceCommit>
pub fn set_user_negotiated( &mut self, user_id: &UserId, connection_id: ConnectionId, capabilities: MediaCapabilities, ) -> Option<bool>
pub fn apply_disconnect_users( &mut self, user_ids: &[UserId], ) -> DisconnectCommit
Sourcepub fn broadcast_fanout(
&self,
user_id: &UserId,
connection_id: ConnectionId,
message: Value,
) -> Result<Option<MessageFanout>, BroadcastPayloadError>
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
impl RoomState
pub fn new( runtime_context: &RoomRuntimeContext, admission_policy: RoomAdmissionPolicy, media_limits: RoomMediaLimits, video_adaptation_tuning: VideoAdaptationTuning, router_rtp_capabilities: MediaCapabilities, ) -> Self
pub fn user_for_connection( &self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<&ActiveUser>
pub fn user_mut_for_connection( &mut self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<&mut ActiveUser>
pub fn recording_state(&self) -> RecordingState
pub fn transport_user_entries( &self, ) -> impl Iterator<Item = (&UserId, ConnectionId)>
Sourcepub fn transport_user_key(
&self,
user_id: &UserId,
connection_id: ConnectionId,
) -> TransportSessionKey
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.
Sourcepub fn committed_transport_user_key(
&self,
user_id: &UserId,
connection_id: ConnectionId,
) -> Option<TransportSessionKey>
pub fn committed_transport_user_key( &self, user_id: &UserId, connection_id: ConnectionId, ) -> Option<TransportSessionKey>
Returns None unless the exact router placement remains committed.
pub fn placement_usage_snapshot(&self) -> PlacementSnapshot
pub fn assigned_primary_media_worker_id(&self) -> Option<MediaWorkerId>
pub(in engine::room) fn committed_consumer_routes( &self, ) -> impl Iterator<Item = ConsumerRouteView<'_>>
pub fn user_connection_id(&self, user_id: &UserId) -> Option<ConnectionId>
pub fn user_count(&self) -> usize
pub fn user_snapshots_except( &self, excluded_user_id: &UserId, ) -> Vec<PeerSnapshot>
pub fn user_info_snapshot(&self, user_id: &UserId) -> Option<(UserId, UserInfo)>
pub(in engine::room) fn remote_track_snapshot_for_user( &mut self, user_id: &UserId, requires_negotiation: bool, ) -> VersionedRemoteTrackSnapshot
pub(in engine::room) fn remote_track_snapshots_for_users( &mut self, user_ids: BTreeSet<UserId>, requires_negotiation: bool, ) -> Vec<(UserOutboundSender, VersionedRemoteTrackSnapshot)>
pub fn user_stats_counts(&self) -> (u64, BTreeMap<UserStreamId, u64>)
pub fn media_counts(&self) -> RoomMediaCounts
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoomState
impl RefUnwindSafe for RoomState
impl Send for RoomState
impl Sync for RoomState
impl Unpin for RoomState
impl UnsafeUnpin for RoomState
impl UnwindSafe for RoomState
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more