o_sfu_core/engine/source_model/mod.rs
1//! Runtime-native source, encoding and selection vocabulary for published media.
2//!
3//! This module defines the room-domain source identity that room state,
4//! transport projection, diagnostics and recording metadata are expected to
5//! share. It is the vocabulary above SDP, browser APIs and worker-local media
6//! handles: those layers may attach facts to a source, but they must not define
7//! the source identity.
8//!
9//! A published media stream is modeled as one [`PublishedSourceId`] plus one or
10//! more [`SourceEncodingId`] values. [`o_sfu_rfc::rtp::Mid`],
11//! [`o_sfu_rfc::rtp::Rid`] and [`o_sfu_rfc::rtp::Ssrc`] stay as negotiated
12//! or transport-facing attachment points. Keeping those identities separate
13//! lets later same-room spillover and recording consume the same source
14//! inventory without redefining it around local worker placement.
15//!
16//! Application layers should express stream-specific behavior by constructing
17//! [`SourcePublishIntent`] and [`SourceDeactivateIntent`] values. Core policy
18//! reads the source [`SourcePolicy`] carried by each source, never compatibility
19//! stream labels.
20//!
21//! # Upload layer profiles
22//!
23//! The server-defined upload ladder lives at the RTC offer edge as
24//! upload-slot metadata, while this module stores the negotiated source
25//! encodings that result from the answer.
26
27mod descriptor;
28mod ids;
29mod intent;
30mod policy;
31mod selection;
32
33pub use descriptor::{
34 PublishedSourceDescriptor, PublishedSourceDescriptorParts, SourceEncodingDescriptor,
35 SourceEncodingDescriptorParts, SourceModelError,
36};
37pub use ids::{PublishedSourceId, PublishedSourceOwner, SourceEncodingId, UserStreamId};
38pub use intent::{SourceDeactivateIntent, SourcePublishIntent, SourceSubscriptionIntent};
39pub use o_sfu_transport::SourceSyncPolicy;
40pub use policy::{
41 ActiveSpeakerGroup, ActiveSpeakerPolicy, ActiveSpeakerSourceRole, PolicyPauseReason,
42 SourceAdaptationPolicy, SourceLayoutPolicy, SourcePolicy, SourceRoomPolicySelector,
43 SourceRoutePriority, UploadLayerPolicyRole,
44};
45pub use selection::SourceSelector;
46
47#[cfg(any(test, feature = "testing-transport"))]
48#[path = "TESTS/test_support.rs"]
49pub mod test_support;
50
51#[cfg(test)]
52#[expect(non_snake_case, reason = "test modules map to local TESTS directories")]
53mod TESTS;