Skip to main content

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 diagnostics;
29mod ids;
30mod intent;
31mod policy;
32mod selection;
33
34pub use descriptor::{
35    PublishedSourceDescriptor, PublishedSourceDescriptorParts, SourceEncodingDescriptor,
36    SourceEncodingDescriptorParts, SourceModelError,
37};
38pub use diagnostics::ReceiverVideoBudgetDiagnostics;
39pub use ids::{PublishedSourceId, PublishedSourceOwner, SourceEncodingId, UserStreamId};
40pub use intent::{SourceDeactivateIntent, SourcePublishIntent, SourceSubscriptionIntent};
41pub use policy::{
42    ActiveSpeakerGroup, ActiveSpeakerPolicy, ActiveSpeakerSourceRole, PolicyPauseReason,
43    SourceAdaptationPolicy, SourceLayoutPolicy, SourcePolicy, SourceRoomPolicySelector,
44    SourceRoutePriority, UploadLayerPolicyRole,
45};
46pub use selection::{ConsumerSourceSelection, SourceSelector};
47
48#[cfg(any(test, feature = "testing-transport"))]
49#[path = "TESTS/support.rs"]
50pub mod test_support;
51
52#[cfg(test)]
53#[allow(non_snake_case, reason = "test modules map to local TESTS directories")]
54mod TESTS;